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.

Component should be able to accept multiple decimal separator inputs

See original GitHub issue

First, I’d like to say that this component saved me sooo much time! I very thankful for your work!

A short description of my problem, and maybe some other people’s:

I have a field which is configured to use ‘,’ (comma) as a decimal separator. When set the component to work this way by doing <NumberFormat decimalSeparator={','} .... />, it all works as expected, except it doesn’t accept entering a dot instead.

What I think it should do is it’d accept both a “.” and any custom decimal separator and convert to the custom one. Example in my case:

If I enter 4,0 it shoud show 4,0 and if I enter 4.0 it should show the same - 4,0. Right now, when I enter 4.0 it just becomes 40.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
s-yadavcommented, Nov 11, 2017

It’s complicated to find the difference between a decimal separator and thousand separator when ‘.’ is used as thousand separator and allowing ‘.’ to be considered as decimal separator while typing. Also as onKeyDown is not reliable will not support this. This is how most of the formatting modules behave so we will continue the existing behaviour.

1reaction
apocacommented, Nov 11, 2017

It’s a huge difference between “.” And “,” I’m not agree with this conclusion. I have two options make a pull request with some profound changes or I leave this repository…

In Europe we have different way to represent currency formats, this is obviously described on intl iso paper.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle floats and decimal separators with html5 input ...
I think what's missing in the answers above is the need to specify a different value for the step attribute, which has a...
Read more >
Using both '.' and ',' as decimal separators in a NumericTextBox
I am using a NumericTextBox in a form to input a decimal number. The only decimal-separating character is " , ". I would...
Read more >
NumericTextField Decimal format - Ignition
When i use numerictextfield component with a float value, it show value ... [BUG] Decimal separator in numeric input field behaves wrong for ......
Read more >
Solved: Good practice: managing local decimal separator
Solved: Hi there, I'm maintaining a software that is delivered in different countries and I have two computers set with different regions to ......
Read more >
How we internationalized our number field
A number field allows users to input and edit numeric values. ... For example, decimals can be rounded to a particular number of...
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