diff options
Diffstat (limited to 'toolkit/components/mozintl')
-rw-r--r-- | toolkit/components/mozintl/mozIntl.sys.mjs | 2 | ||||
-rw-r--r-- | toolkit/components/mozintl/test/test_mozintl.js | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/toolkit/components/mozintl/mozIntl.sys.mjs b/toolkit/components/mozintl/mozIntl.sys.mjs index 50633e365c..ad0b4dd5d9 100644 --- a/toolkit/components/mozintl/mozIntl.sys.mjs +++ b/toolkit/components/mozintl/mozIntl.sys.mjs @@ -143,7 +143,7 @@ function bestFit(absDiff) { * Thresholds to use for calculating the best unit for relative time fromatting. */ const threshold = { - month: 2, // at least 2 months before using year. + month: 11, // at least 11 months before using year. week: 3, // at least 3 weeks before using month. day: 6, // at least 6 days before using week. hour: 6, // at least 6 hours before using day. diff --git a/toolkit/components/mozintl/test/test_mozintl.js b/toolkit/components/mozintl/test/test_mozintl.js index dc7b8a7afd..2ee1583b8c 100644 --- a/toolkit/components/mozintl/test/test_mozintl.js +++ b/toolkit/components/mozintl/test/test_mozintl.js @@ -139,6 +139,10 @@ function test_rtf_formatBestUnit() { let anchor = new Date("2016-04-10 12:00:00"); testRTFBestUnit(anchor, "2014-04-01 00:00", "2 years ago"); testRTFBestUnit(anchor, "2015-03-01 00:00", "last year"); + testRTFBestUnit(anchor, "2015-04-01 00:00", "last year"); + testRTFBestUnit(anchor, "2015-05-01 00:00", "11 months ago"); + testRTFBestUnit(anchor, "2015-12-01 00:00", "4 months ago"); + testRTFBestUnit(anchor, "2016-02-01 00:00", "2 months ago"); testRTFBestUnit(anchor, "2017-05-01 00:00", "next year"); testRTFBestUnit(anchor, "2024-12-01 23:59", "in 8 years"); @@ -147,8 +151,10 @@ function test_rtf_formatBestUnit() { testRTFBestUnit(anchor, "2015-12-29 18:30", "2 years ago"); anchor = new Date("2016-12-29 18:30"); - testRTFBestUnit(anchor, "2017-07-12 18:30", "next year"); testRTFBestUnit(anchor, "2017-02-12 18:30", "in 2 months"); + testRTFBestUnit(anchor, "2017-07-12 18:30", "in 7 months"); + testRTFBestUnit(anchor, "2017-11-29 18:30", "in 11 months"); + testRTFBestUnit(anchor, "2017-12-01 18:30", "next year"); testRTFBestUnit(anchor, "2018-01-02 18:30", "in 2 years"); testRTFBestUnit(anchor, "2098-01-02 18:30", "in 82 years"); |