Allow localization of month-day format string

The short month-day format ex: 'Aug 8', is not built-in to momentjs, so
we need to localize it.

// FREEBIE
This commit is contained in:
lilia 2016-08-11 17:42:00 -07:00
parent 93edce87aa
commit 9ab64ec44d
2 changed files with 9 additions and 5 deletions

View file

@ -320,5 +320,9 @@
"timestamp_h": { "timestamp_h": {
"description": "Brief timestamp for messages sent about one minute ago. Displayed in the conversation list and message bubble.", "description": "Brief timestamp for messages sent about one minute ago. Displayed in the conversation list and message bubble.",
"message": "1 hour" "message": "1 hour"
},
"timestampFormat_M": {
"description": "Timestamp format string for displaying month and day (but not the year) of a date within the current year, ex: use 'MMM D' for 'Aug 8', or 'D MMM' for '8 Aug'.",
"message": "MMM D"
} }
} }

View file

@ -53,7 +53,7 @@
return timestamp.format(this._format.y); return timestamp.format(this._format.y);
} else if (timediff.months() > 0 || timediff.days() > 6) { } else if (timediff.months() > 0 || timediff.days() > 6) {
this.delay = null; this.delay = null;
return timestamp.format(this._format.mo); return timestamp.format(this._format.M);
} else if (timediff.days() > 0) { } else if (timediff.days() > 0) {
this.delay = moment(timestamp).add(timediff.days() + 1,'d').diff(moment()); this.delay = moment(timestamp).add(timediff.days() + 1,'d').diff(moment());
return timestamp.format(this._format.d); return timestamp.format(this._format.d);
@ -78,8 +78,8 @@
return moment.duration(number, string).humanize(); return moment.duration(number, string).humanize();
}, },
_format: { _format: {
y: "MMM D, YYYY", y: "ll",
mo: "MMM D", M: i18n('timestampFormat_M') || "MMM D",
d: "ddd" d: "ddd"
} }
}); });
@ -88,8 +88,8 @@
return moment.duration(-1 * number, string).humanize(string !== 's'); return moment.duration(-1 * number, string).humanize(string !== 's');
}, },
_format: { _format: {
y: "MMM D, YYYY LT", y: "lll",
mo: "MMM D LT", M: (i18n('timestampFormat_M') || "MMM D") + ' LT',
d: "ddd LT" d: "ddd LT"
} }
}); });