use calendar date formatting for all languages but EN_US - fixes #944
parent
0dbe4e5741
commit
b97f071388
|
@ -69,7 +69,7 @@ trait DateHelper { self: I18nHelper =>
|
|||
def momentFormat(date: DateTime, format: String): Html = Html {
|
||||
s"""<time class="moment" datetime="${isoDate(date)}" data-format="$format"></time>"""
|
||||
}
|
||||
def momentFormat(date: DateTime): Html = momentFormat(date, "DD MMM YYYY")
|
||||
def momentFormat(date: DateTime): Html = momentFormat(date, "calendar")
|
||||
|
||||
def momentFromNow(date: DateTime)(implicit ctx: Context) = Html {
|
||||
s"""<time class="moment-from-now" title="${showDate(date)}" datetime="${isoDate(date)}"></time>"""
|
||||
|
|
|
@ -752,11 +752,14 @@ lichess.desktopNotification = function(msg) {
|
|||
});
|
||||
});
|
||||
|
||||
var documentLang;
|
||||
function setMoment() {
|
||||
documentLang = documentLang || $('html').attr('lang');
|
||||
$("time.moment").removeClass('moment').each(function() {
|
||||
var parsed = moment(this.getAttribute('datetime'));
|
||||
var format = this.getAttribute('data-format');
|
||||
this.textContent = format == 'calendar' ? parsed.calendar() : parsed.format(format);
|
||||
if (format === 'calendar' && documentLang === 'en') format = 'DD MMM YYYY';
|
||||
this.textContent = format === 'calendar' ? parsed.calendar() : parsed.format(format);
|
||||
});
|
||||
}
|
||||
setMoment();
|
||||
|
|
Loading…
Reference in New Issue