question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unformat not working with non localized delimiters

See original GitHub issue

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 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:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
BenjaminVanRyseghemcommented, Jan 18, 2019

in numbro 2.1.2

Sorry guys for the delay, tough times here 😕

0reactions
Rambobafetcommented, Jan 18, 2019

Thanks Benjamin, wish you the best

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found