Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[locale] fi: fix ss not returning the number of seconds #5595

Merged
merged 2 commits into from Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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