react-number-format icon indicating copy to clipboard operation
react-number-format copied to clipboard

Issue with decimalScale=0 and pressing .-key

Open benneq opened this issue 6 years ago • 1 comments

When using decimalScale=0 the component deletes all following numbers when pressing the . (or decimalSeparator key).

<NumberFormat
  decimalScale={0}
  decimalSeparator=","
  thousandsSeparator="."
/>

Steps to reproduce:

  1. The input contains the following number: 12345
  2. Place the cursor between 3 and 4
  3. Press . or , (= decimalSeparator)

Now everything behind the cursor (= 45) will get deleted. The new value within the input is 123.

I don't think this is nice behavior. Or is this intended?

benneq avatar Jan 01 '19 15:01 benneq

I also encountered the same problem. Is it a bug? Is there another way to prevent decimal input, guys?

khanhvtn avatar Apr 19 '23 15:04 khanhvtn