mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 13:20:48 +00:00
Fix timestamp tests
These were failing because chrome's i18n functions aren't available in test. // FREEBIE
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
return timestamp.format(this._format.y);
|
||||
} else if (timediff.months() > 0 || timediff.days() > 6) {
|
||||
this.delay = null;
|
||||
return timestamp.format(this._format.m);
|
||||
return timestamp.format(this._format.mo);
|
||||
} else if (timediff.days() > 0) {
|
||||
this.delay = moment(timestamp).add(timediff.days() + 1,'d').diff(moment());
|
||||
return timestamp.format(this._format.d);
|
||||
@@ -66,21 +66,33 @@
|
||||
}
|
||||
},
|
||||
relativeTime : function (number, string, isFuture) {
|
||||
return i18n("timestamp_"+string).replace(/%d/i, number);
|
||||
var format = i18n("timestamp_"+string) || this._format[string];
|
||||
return format.replace(/%d/i, number);
|
||||
},
|
||||
_format: {
|
||||
s: "now",
|
||||
m: "1 min",
|
||||
mm: "%d min",
|
||||
h: "1 hour",
|
||||
hh: "%d hours",
|
||||
y: "MMM D, YYYY",
|
||||
m: "MMM D",
|
||||
mo: "MMM D",
|
||||
d: "ddd"
|
||||
}
|
||||
});
|
||||
Whisper.ExtendedTimestampView = Whisper.TimestampView.extend({
|
||||
relativeTime : function (number, string, isFuture) {
|
||||
return i18n("extendedTimestamp_"+string).replace(/%d/i, number);
|
||||
var format = i18n("extendedTimestamp_"+string) || this._format[string];
|
||||
return format.replace(/%d/i, number);
|
||||
},
|
||||
_format: {
|
||||
s: "now",
|
||||
m: "%d minute ago",
|
||||
mm: "%d minutes ago",
|
||||
h: "%d hour ago",
|
||||
hh: "%d hours ago",
|
||||
y: "MMM D, YYYY LT",
|
||||
m: "MMM D LT",
|
||||
mo: "MMM D LT",
|
||||
d: "ddd LT"
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user