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.

ThousandSeparator with leading zeros

See original GitHub issue

The thousandSeparator is also added if your number starts with leading zeros. Consider the following (standard) configuration:

<NumberFormat thousandSeparator="," decimalSeparator="." />

When you enter 0123 it will be displayed as 0,123

The problem that arises with this is that we have some users who want to enter a decimal point as a comma (,). So you type:

  • 0: The field now shows 0
  • ,: The field still shows 0
  • 1: The field shows 01
  • 2: The field shows 012
  • 3: The field now shows 0,123

If you don’t pay close attention, you get the feeling that you correctly entered 0.123. Only after the next blur event, you will see that you actually entered 123.

So the question is: Would it be possible to only append the thousandSeparator in places where the value is actually bigger than a thousand, discounting leading zeros?

That would mean that 0123 would be displayed as 0123 rather than 0,123.

Frankly, it seems to work for numbers with more than 4 characters, as 01234 is correctly displayed as 01,234.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
s-yadavcommented, Mar 19, 2019

In npm it was already there. Added it on releases as well.

1reaction
s-yadavcommented, Mar 10, 2019

Agree, The thousand separator should ignore leading zeros. Will fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Format number with leading zeros and thousand separator
I'd like to format an integer in a way that it has leading zeros and thousand separators at the same ...
Read more >
How to: Pad a Number with Leading Zeros | Microsoft Learn
To pad an integer with leading zeros to a specific length ... Determine whether you want to display the integer as a decimal...
Read more >
Formatting a number with thousand separators - SQLMatters
Website : I use SELECT FORMAT(1234567891234, '#,#') its very good idea but not work when number is 0 , 0.0 or any type...
Read more >
Formatting Numbers with Custom Formats
This class allows you to control the display of leading and trailing zeros, prefixes and suffixes, grouping (thousands) separators, and the decimal separator....
Read more >
How to fix Mail Merge formatting issues in Word - Ablebits
In Excel, a leading zero is displayed because a cell has a custom number ... the currency symbol, thousands separator, and decimal places....
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