Deleting first digit of otherwise all-zero number makes input zero
See original GitHub issueIf you enter a single digit followed only by zeros, such as 10000
, move to the first position and delete the first character the input turns to 0
.
I don’t think this is expected behaviour, as you might enter 1000000
and want to change it to 2000000
by moving to the start, deleting 1
and replacing with 2
in which case you end up with just 2
. It’s also not how the native HTML number input works (which keeps zeros). I personally keep running into it.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
REMOVE FIRST DIGIT IF ITS ZERO : r/zapier
Hello, I want to ask if the value is starting with zero, how to remove that value? (Example: 0506565 remove 0 so result...
Read more >Program to delete Nth digit of a Number
Approach: To delete nth digit from starting: Get the number and the nth digit to be deleted. Count the number of digits; Loop...
Read more >Regex remove leading zeros if string is number
I managed to remove the leading zeros with 0*(.{0,10})$ but how do I proceed in case any non-digit is included? If possible, it...
Read more >removing the first character of a string variable if it is zero
Hi everyone, How can I remove the first character(s) of values if they are zero? For example, I would like to convert 0003...
Read more >parseInt() - JavaScript - MDN Web Docs
parseInt() does not treat strings beginning with a 0 character as ... everything else is parsed as a decimal value if radix is...
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 Free
Top 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
Changes available on v3.0.0-alpha3
Humm… I agree. But this has been added to remove extra 0’s from the starting. I have to see how NumberFormat can smartly identify if the user’s intention is to change the number. One possible way I can think of is to keep zeros while anything got removed, but as soon we type something do the extra zero formatting. I will evaluate this idea if it doesn’t break anything else.