FIX: Post age time not being translated correctly.

This commit is contained in:
Guo Xiang Tan 2015-08-31 00:11:52 +08:00
parent 322df1862d
commit 50ce95b37d
2 changed files with 4 additions and 3 deletions

View File

@ -142,13 +142,13 @@ function relativeAgeTiny(date){
case(distanceInMinutes >= 45 && distanceInMinutes <= 89): case(distanceInMinutes >= 45 && distanceInMinutes <= 89):
formatted = t("about_x_hours", {count: 1}); formatted = t("about_x_hours", {count: 1});
break; break;
case(distanceInMinutes >= 90 && distanceInMinutes <= 1439): case(distanceInMinutes >= 90 && distanceInMinutes <= 1409):
formatted = t("about_x_hours", {count: Math.round(distanceInMinutes / 60.0)}); formatted = t("about_x_hours", {count: Math.round(distanceInMinutes / 60.0)});
break; break;
case(Discourse.SiteSettings.relative_date_duration === 0 && distanceInMinutes <= 525599): case(Discourse.SiteSettings.relative_date_duration === 0 && distanceInMinutes <= 525599):
formatted = shortDateNoYear(date); formatted = shortDateNoYear(date);
break; break;
case(distanceInMinutes >= 1440 && distanceInMinutes <= 2519): case(distanceInMinutes >= 1410 && distanceInMinutes <= 2519):
formatted = t("x_days", {count: 1}); formatted = t("x_days", {count: 1});
break; break;
case(distanceInMinutes >= 2520 && distanceInMinutes <= ((Discourse.SiteSettings.relative_date_duration||14) * 1440)): case(distanceInMinutes >= 2520 && distanceInMinutes <= ((Discourse.SiteSettings.relative_date_duration||14) * 1440)):
@ -266,4 +266,3 @@ export function number(val) {
} }
return val.toString(); return val.toString();
} }

View File

@ -91,6 +91,8 @@ test("formating tiny dates", function() {
equal(formatMins(2), "2m"); equal(formatMins(2), "2m");
equal(formatMins(60), "1h"); equal(formatMins(60), "1h");
equal(formatHours(4), "4h"); equal(formatHours(4), "4h");
equal(formatHours(23), "23h");
equal(formatHours(23.5), "1d");
equal(formatDays(1), "1d"); equal(formatDays(1), "1d");
equal(formatDays(14), "14d"); equal(formatDays(14), "14d");
equal(formatDays(15), shortDate(15)); equal(formatDays(15), shortDate(15));