add support for locales to format numbers in NumberInput
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
I’m using NumberInput and I was trying to find a way how to format the number depending on the user’s locale. I did find the pattern option but that’s only for validation on submit. It would be great to add a way to tell the NumberInput what format to use, similar to the Intl.NumberFormat
class
Describe the solution you’d like
When you work with multiple locales, number format can differ. Some locales has ,
as the decimal separator.
I don’t know if this is planned for the future or maybe not but I think it would be a great addition to the library
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Localization of input type number - html - Stack Overflow
On my Chrome, the input type=number step=0.001 accepts 1,2 (with comma) and sends it as 1.2 and it accepts 1.200 (with a period),...
Read more >Locale-based forms - Internationalization
Currently, it appears that the browser uses the locale of the system to determine the format of input such as numbers and dates....
Read more ><input type="number"> - HTML: HyperText Markup Language
<input> elements of type number are used to let the user enter a number. They include built-in validation to reject non-numerical entries.
Read more >Culture formatted custom number input
I am looking for a nice, open source, method in js/jquery to add number input fields to my page. I am located in...
Read more >Solving Cross-Browsers Localization on Numeric Inputs
My journey to numbers-localization and cross-browser support begins. ... language by translating text and adding locale-specific components”.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
but even changing the pattern to accept other formats, it will still be invalid, based on what it says on the prop comments the pattern is only used to validate on submit, right?
the problem is not formatting the value or parsing it before submitting, the problem is that NI will treat the value as invalid afaik
in that same example, if you use
1,53
instead of1.53
you’ll see that then the NI is in fact invalid and if you go up or down then you lose the value