Locale FI - breaks from other languages in relative time format
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
In FI locale, the relative format replaces the numeral with a word, when the number is less than 10
```
if (number < 10) {
return result.replace('%d', words.numbers[number])
}
```
Like: `kahdeksan kuukautta sitten`
https://github.com/iamkun/dayjs/blame/2076da970047c6e0a22c8d4243a42d52833a5df2/src/locale/fi.js#L35
This is highly inconsistent with the examples that are given on any other language ( https://day.js.org/docs/en/display/from-now ), and does not seem to be a specific instrument or requirement of the language, but a stylistic choice (ie, `1 vuoden päästä` is understood as `yhden` and not `yksi`, given the context.)
The main drawback of the previous approach is that it takes a lot of space with numbers like 8 and 9 (`kahdeksan` and `yhdeksän`). Especially when coupled with `kuukautta sitten` it starts to limit the usability in certain UI elements given the space it needs (eg. mobile interfaces)
**Expected behavior**
The FI locale should output roughly the same format as mentioned in the documentation - https://day.js.org/docs/en/display/from-now - using numerals rather than spelling out the number.
Contributor guide
Research direction
Start with src/locale/fi.js around the relative-time formatting at line 35, then compare its output with the documented from-now examples. Done means Finnish relative times use numerals rather than spelling out numbers below 10, while retaining the correct Finnish surrounding text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- localization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100