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.

Deleting first digit of otherwise all-zero number makes input zero

See original GitHub issue

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

github_iconTop GitHub Comments

1reaction
s-yadavcommented, Oct 17, 2017

Changes available on v3.0.0-alpha3

1reaction
s-yadavcommented, Oct 5, 2017

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.

Read more comments on GitHub >

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

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