Skip to content

fix: use singular Lithuanian form for counts like 101 and 201#237

Merged
EvanHahn merged 1 commit into
EvanHahn:mainfrom
greymoth-jp:fix-lithuanian-101
Jun 30, 2026
Merged

fix: use singular Lithuanian form for counts like 101 and 201#237
EvanHahn merged 1 commit into
EvanHahn:mainfrom
greymoth-jp:fix-lithuanian-101

Conversation

@greymoth-jp

Copy link
Copy Markdown
Contributor

The Lithuanian plural helper picks the wrong form for counts whose last two digits are "01" (101, 201, 301, and so on). It returns the genitive plural instead of the singular, so a 101 ms duration renders as "101 milisekundžių" instead of "101 milisekundė".

getLithuanianForm detected the singular ("one") form with:

c === 1 || (c % 10 === 1 && c % 100 > 20)

The c % 100 > 20 guard is there to exclude 11 (where Lithuanian uses the plural), but it also excludes c % 100 === 1 (101, 201, ...), which should be singular. The Latvian helper right below it already uses the correct idiom:

return c % 10 === 1 && c % 100 !== 11;

That also matches the CLDR Lithuanian rule, where one is i % 10 = 1 and i % 100 != 11..19; for the integer counts handled here that reduces to i % 10 === 1 && i % 100 !== 11. So 1, 21, 31, ..., 101, 121 are singular and 11, 111, 211 stay plural.

This reuses that idiom for Lithuanian. The counts that were already correct (1, 21 through 91, and 11..19) are unchanged; only 101, 201, ..., 901 move from the plural to the singular form.

Also added two rows to test/definitions/lt.tsv (101 -> singular, 211 -> still plural) and a HISTORY.md entry.

@EvanHahn EvanHahn merged commit 0f69e09 into EvanHahn:main Jun 30, 2026
1 check passed
@EvanHahn

Copy link
Copy Markdown
Owner

Thanks! This has been published in humanize-duration@3.34.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants