-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Provide a general summary of the issue here
Using the NumberField in slavic languages causes issues when adding the formatOptions { type: 'unit', unit: 'year', style, unitDisplay: 'long' }
.
🤔 Expected Behavior?
The user should still be able to cycle through the options. For example for polish it should start with:
- 0 lat
- 1 rok
- 2-4 lata
- 5 lat
But in case the value uses decimals it should be 3.1 roku.
😯 Current Behavior
When the user starts interacting with the NumberField the value would always be 0 lat.
💁 Possible Solution
The issue seems to be caused in the getSymbols method of the NumberFieldParser where the characters are determined which can be in front or at the end of the entered value. This only checks the used symbols for the a large decimal number 10000.111
-10000.111
and 1
causing the year option not to work in case pluralisation rules needs to be applied.
react-spectrum/packages/@internationalized/number/src/NumberParser.ts
Lines 196 to 198 in a399db1
let allParts = formatter.formatToParts(-10000.111); | |
let posAllParts = formatter.formatToParts(10000.111); | |
let singularParts = formatter.formatToParts(1); |
🔦 Context
There is an article I found showing the different types of pluralisation rules in different languages. https://lingohub.com/blog/2019/02/pluralization
🖥️ Steps to Reproduce
https://codesandbox.io/s/cool-fast-mhls6q?file=/src/App.js
Version
1.0.0-alpha-5
What browsers are you seeing the problem on?
Other
If other, please specify.
The issue is in all browsers
What operating system are you using?
MacOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response