FIX: Error in smart short date function

This commit is contained in:
Robin Ward 2016-05-20 16:06:37 -04:00
parent 1643ff0f3c
commit 90330d30f4
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
2 changed files with 3 additions and 4 deletions

View File

@ -56,8 +56,8 @@ function shortDateNoYear(date) {
} }
// Suppress year if it's this year // Suppress year if it's this year
export function smartShortDate(date) { export function smartShortDate(date, withYear=tinyDateYear) {
return (date.getFullYear() === new Date().getFullYear()) ? shortDateNoYear(date) : tinyDateYear(date); return (date.getFullYear() === new Date().getFullYear()) ? shortDateNoYear(date) : withYear(date);
} }
export function tinyDateYear(date) { export function tinyDateYear(date) {
@ -220,7 +220,7 @@ function relativeAgeMedium(date, options) {
if (distance < oneMinuteAgo) { if (distance < oneMinuteAgo) {
displayDate = I18n.t("now"); displayDate = I18n.t("now");
} else if (distance > fiveDaysAgo) { } else if (distance > fiveDaysAgo) {
displayDate = smartShortDate(date); displayDate = smartShortDate(date, shortDate);
} else { } else {
displayDate = relativeAgeMediumSpan(distance, leaveAgo); displayDate = relativeAgeMediumSpan(distance, leaveAgo);
} }

View File

@ -80,7 +80,6 @@ test("formating medium length dates", function() {
equal(strip(formatDays(8)), shortDate(8)); equal(strip(formatDays(8)), shortDate(8));
equal(strip(formatDays(10)), shortDateYear(10)); equal(strip(formatDays(10)), shortDateYear(10));
}); });
test("formating tiny dates", function() { test("formating tiny dates", function() {