Skip to content

Commit

Permalink
[locale] fi: fix ss not returning the number of seconds (#5595)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hietamaki committed Jun 17, 2020
1 parent e1a969c commit 5e993f3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/locale/fi.js
Expand Up @@ -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':
Expand Down
31 changes: 31 additions & 0 deletions src/test/locale/fi.js
Expand Up @@ -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');
Expand Down

0 comments on commit 5e993f3

Please sign in to comment.