unformat not working with non localized delimiters
See original GitHub issueWe are using different languages like en-US
and de-DE
where delimiters are different according to the language.
When de-DE
is selected (thousand delimiter is .
, decimal is ,
) and we call
numbro.unformat('180.000')
the result is 180
opposed to the expected 180000
. The reason is this line, which is not respecting the delimiters.
if (!isNaN(+inputString)) {
return +inputString;
}
I guess this was added for performance reasons!? When I remove it, everything is working as expected.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
unformat not working with non localized delimiters #328 - GitHub
We are using different languages like en-US and de-DE where delimiters are different according to the language. When de-DE is selected (thousand delimiter...
Read more >Is there a way to reverse the formatting by Intl.NumberFormat ...
I have found a workaround: /** * Parse a localized number to a float. * @param {string} stringNumber - the localized number *...
Read more >Intl.NumberFormat - JavaScript - MDN Web Docs
Chrome Edge
NumberFormat Full support. Chrome24. Toggle history Full support. Ed...
NumberFormat() constructor Full support. Chrome24. Toggle history Full support. Ed...
options.compactDisplay parameter Full support. Chrome77....
Read more >READ
The READ command is primarily intended for reading from the terminal or from ASCII files. Dataplot has limited support for binary data files...
Read more >String.Format Method (System) - Microsoft Learn
Converts the value of objects to strings based on the formats specified and inserts them into another string. If you are new to...
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
in numbro 2.1.2
Sorry guys for the delay, tough times here 😕
Thanks Benjamin, wish you the best