mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
Merge pull request #3708 from tgxworld/fix_post_age_time
FIX: Post age time not being translated correctly.
This commit is contained in:
commit
6dba567001
|
@ -142,13 +142,13 @@ function relativeAgeTiny(date){
|
|||
case(distanceInMinutes >= 45 && distanceInMinutes <= 89):
|
||||
formatted = t("about_x_hours", {count: 1});
|
||||
break;
|
||||
case(distanceInMinutes >= 90 && distanceInMinutes <= 1439):
|
||||
case(distanceInMinutes >= 90 && distanceInMinutes <= 1409):
|
||||
formatted = t("about_x_hours", {count: Math.round(distanceInMinutes / 60.0)});
|
||||
break;
|
||||
case(Discourse.SiteSettings.relative_date_duration === 0 && distanceInMinutes <= 525599):
|
||||
formatted = shortDateNoYear(date);
|
||||
break;
|
||||
case(distanceInMinutes >= 1440 && distanceInMinutes <= 2519):
|
||||
case(distanceInMinutes >= 1410 && distanceInMinutes <= 2519):
|
||||
formatted = t("x_days", {count: 1});
|
||||
break;
|
||||
case(distanceInMinutes >= 2520 && distanceInMinutes <= ((Discourse.SiteSettings.relative_date_duration||14) * 1440)):
|
||||
|
@ -189,10 +189,10 @@ function relativeAgeMediumSpan(distance, leaveAgo) {
|
|||
case(distanceInMinutes >= 56 && distanceInMinutes <= 89):
|
||||
formatted = t("x_hours", {count: 1});
|
||||
break;
|
||||
case(distanceInMinutes >= 90 && distanceInMinutes <= 1379):
|
||||
case(distanceInMinutes >= 90 && distanceInMinutes <= 1409):
|
||||
formatted = t("x_hours", {count: Math.round(distanceInMinutes / 60.0)});
|
||||
break;
|
||||
case(distanceInMinutes >= 1380 && distanceInMinutes <= 2159):
|
||||
case(distanceInMinutes >= 1410 && distanceInMinutes <= 2159):
|
||||
formatted = t("x_days", {count: 1});
|
||||
break;
|
||||
case(distanceInMinutes >= 2160):
|
||||
|
@ -266,4 +266,3 @@ export function number(val) {
|
|||
}
|
||||
return val.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ test("formating medium length dates", function() {
|
|||
equal(strip(formatMins(56)), "1 hour ago");
|
||||
equal(strip(formatHours(4)), "4 hours ago");
|
||||
equal(strip(formatHours(22)), "22 hours ago");
|
||||
equal(strip(formatHours(23)), "1 day ago");
|
||||
equal(strip(formatHours(23)), "23 hours ago");
|
||||
equal(strip(formatHours(23.5)), "1 day ago");
|
||||
equal(strip(formatDays(4.85)), "4 days ago");
|
||||
|
||||
leaveAgo = false;
|
||||
|
@ -63,7 +64,8 @@ test("formating medium length dates", function() {
|
|||
equal(strip(formatMins(56)), "1 hour");
|
||||
equal(strip(formatHours(4)), "4 hours");
|
||||
equal(strip(formatHours(22)), "22 hours");
|
||||
equal(strip(formatHours(23)), "1 day");
|
||||
equal(strip(formatHours(23)), "23 hours");
|
||||
equal(strip(formatHours(23.5)), "1 day");
|
||||
equal(strip(formatDays(4.85)), "4 days");
|
||||
|
||||
equal(strip(formatDays(6)), shortDate(6));
|
||||
|
@ -91,6 +93,8 @@ test("formating tiny dates", function() {
|
|||
equal(formatMins(2), "2m");
|
||||
equal(formatMins(60), "1h");
|
||||
equal(formatHours(4), "4h");
|
||||
equal(formatHours(23), "23h");
|
||||
equal(formatHours(23.5), "1d");
|
||||
equal(formatDays(1), "1d");
|
||||
equal(formatDays(14), "14d");
|
||||
equal(formatDays(15), shortDate(15));
|
||||
|
|
Loading…
Reference in New Issue
Block a user