s-yadav / react-number-format

React component to format numbers in an input or as a text.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zero padding issue after options setting decimalScale and fixedDecimalScale.

EndlessDev2016 opened this issue · comments

Describe the issue and the actual behavior

After setting decimalScale and fixedDecimalScale in <NumericFormat /> component, and then "delete"(not backspace) keypress before the decimal point "0" will be added.

Describe the expected behavior

if the delete key before the decimal point, the 0 will not be added in.

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/s/fixeddecimalscale-demo-forked-cfn3ly?file=/src/App.js

Provide steps to reproduce this issue

  • the cursor 3 digits before the decimal number "123" and delete key
    123,456.12000
    12,356.12000
    1,236.12000
    123.12000

  • the cursor "123" (before the decimal point) and then delete key
    12,312,000.00000

Please check the browsers where the issue is seen

  • Chrome
  • Edge
  • Chrome (Android)
  • Safari (OSX)
  • Safari (iOS)
  • Firefox
  • Firefox (Android)

Fixed on 5.3.1

Please add the ability to move carriages to decimal digits after deleting the digit before the delimiter on the "Delete" key.