Skip to content

fix: read the narrow month and week names Intl prints in ru - #83

Merged
dy merged 1 commit into
jkroso:masterfrom
zzoraemon043:fix/ru-narrow-units
Nov 27, 2026
Merged

dy merged 1 commit into
jkroso:masterfrom
zzoraemon043:fix/ru-narrow-units

Conversation

@zzoraemon043

Copy link
Copy Markdown
Contributor

Intl.DurationFormat('ru', { style: 'narrow' }) writes months as м. and weeks as н.:

new Intl.DurationFormat('ru', { style: 'narrow' }).format({ months: 2, weeks: 1, days: 3 })
// '2 м. 1 н. 3 д.'

With the ru locale, parse('2 м. 1 н. 3 д.') drops the months and weeks and returns only the days (parse('2 м.') is null). #82 added the short forms (мес., нед.); this adds the narrow ones as aliases of month and week. Neither letter is used for another unit in ru (minutes are мин).

Checked by formatting random durations with Intl.DurationFormat('ru') in the long, short and narrow styles and parsing them back: the narrow month and week cases were the only mismatches, and they now match.

Added a locale narrow forms test, which fails before the change. npm test passes (205).

@dy
dy merged commit ed990e1 into jkroso:master Nov 27, 2026
3 checks passed
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