From 5e993f38b927ea0c1ed956635bb9b2f080c62241 Mon Sep 17 00:00:00 2001 From: Santtu Date: Wed, 17 Jun 2020 19:09:51 +0300 Subject: [PATCH] [locale] fi: fix ss not returning the number of seconds (#5595) --- src/locale/fi.js | 3 ++- src/test/locale/fi.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/locale/fi.js b/src/locale/fi.js index 68f14e4d02..b40e3d3197 100644 --- a/src/locale/fi.js +++ b/src/locale/fi.js @@ -25,7 +25,8 @@ function translate(number, withoutSuffix, key, isFuture) { case 's': return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; case 'ss': - return isFuture ? 'sekunnin' : 'sekuntia'; + result = isFuture ? 'sekunnin' : 'sekuntia'; + break; case 'm': return isFuture ? 'minuutin' : 'minuutti'; case 'mm': diff --git a/src/test/locale/fi.js b/src/test/locale/fi.js index 9853924142..b4341257c3 100644 --- a/src/test/locale/fi.js +++ b/src/test/locale/fi.js @@ -289,6 +289,37 @@ test('from', function (assert) { ); }); +test('from ss threshold set', function (assert) { + var start = moment([2007, 1, 28]), + s = moment.relativeTimeThreshold('s'), + ss = moment.relativeTimeThreshold('ss'); + moment.relativeTimeThreshold('s', 45); + moment.relativeTimeThreshold('ss', 10); + + assert.equal( + start.from(moment([2007, 1, 28]).add({ s: 10 }), true), + 'muutama sekunti', + '10 seconds = few seconds' + ); + assert.equal( + start.from(moment([2007, 1, 28]).add({ s: 11 }), true), + '11 sekuntia', + '11 seconds = 11 seconds' + ); + assert.equal( + start.from(moment([2007, 1, 28]).add({ s: 44 }), true), + '44 sekuntia', + '44 seconds = 44 seconds' + ); + assert.equal( + start.from(moment([2007, 1, 28]).add({ s: 45 }), true), + 'minuutti', + '45 seconds = a minute' + ); + moment.relativeTimeThreshold('s', s); + moment.relativeTimeThreshold('ss', ss); +}); + test('suffix', function (assert) { assert.equal(moment(30000).from(0), 'muutaman sekunnin päästä', 'prefix'); assert.equal(moment(0).from(30000), 'muutama sekunti sitten', 'suffix');