FIX: Topic entrace considered the same day of a different month as today.

This commit is contained in:
Robin Ward 2014-08-18 17:40:50 -04:00
parent 14c765ef11
commit 68fca9398d

View File

@ -1,18 +1,18 @@
function entranceDate(bumpedAt, showTime) { function entranceDate(dt, showTime) {
var today = new Date(); var today = new Date();
if (bumpedAt.getDate() === today.getDate()) { if (dt.toDateString() === today.toDateString()) {
return moment(bumpedAt).format(I18n.t("dates.time")); return moment(dt).format(I18n.t("dates.time"));
} }
if (bumpedAt.getYear() === today.getYear()) { if (dt.getYear() === today.getYear()) {
// No year // No year
return moment(bumpedAt).format( return moment(dt).format(
showTime ? I18n.t("dates.long_no_year") : I18n.t("dates.long_no_year_no_time") showTime ? I18n.t("dates.long_no_year") : I18n.t("dates.long_no_year_no_time")
); );
} }
return moment(bumpedAt).format( return moment(dt).format(
showTime ? I18n.t('dates.long_with_year') : I18n.t('dates.long_with_year_no_time') showTime ? I18n.t('dates.long_with_year') : I18n.t('dates.long_with_year_no_time')
); );
} }