fix DateUtils inconsistency with 12/24h

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2017-09-13 13:20:24 +01:00
parent 738c81b506
commit 1b73707e05
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
1 changed files with 4 additions and 4 deletions

View File

@ -77,7 +77,7 @@ module.exports = {
const days = getDaysArray(); const days = getDaysArray();
const months = getMonthsArray(); const months = getMonthsArray();
if (date.toDateString() === now.toDateString()) { if (date.toDateString() === now.toDateString()) {
return this.formatTime(date); return this.formatTime(date, showTwelveHour);
} else if (now.getTime() - date.getTime() < 6 * 24 * 60 * 60 * 1000) { } else if (now.getTime() - date.getTime() < 6 * 24 * 60 * 60 * 1000) {
// TODO: use standard date localize function provided in counterpart // TODO: use standard date localize function provided in counterpart
return _t('%(weekDayName)s %(time)s', { return _t('%(weekDayName)s %(time)s', {
@ -90,7 +90,7 @@ module.exports = {
weekDayName: days[date.getDay()], weekDayName: days[date.getDay()],
monthName: months[date.getMonth()], monthName: months[date.getMonth()],
day: date.getDate(), day: date.getDate(),
time: this.formatTime(date), time: this.formatTime(date, showTwelveHour),
}); });
} }
return this.formatFullDate(date, showTwelveHour); return this.formatFullDate(date, showTwelveHour);
@ -104,7 +104,7 @@ module.exports = {
monthName: months[date.getMonth()], monthName: months[date.getMonth()],
day: date.getDate(), day: date.getDate(),
fullYear: date.getFullYear(), fullYear: date.getFullYear(),
time: showTwelveHour ? twelveHourTime(date) : this.formatTime(date), time: this.formatTime(date, showTwelveHour),
}); });
}, },
@ -142,7 +142,7 @@ module.exports = {
formatTime: function(date, showTwelveHour=false) { formatTime: function(date, showTwelveHour=false) {
if (showTwelveHour) { if (showTwelveHour) {
return twelveHourTime(date); return twelveHourTime(date);
} }
return pad(date.getHours()) + ':' + pad(date.getMinutes()); return pad(date.getHours()) + ':' + pad(date.getMinutes());
}, },