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

`allowLeadingZeroes` prop doesn't work

pmwals09 opened this issue · comments

Describe the issue and the actual behavior

The allowLeadingZeroes property does not appear to be making any difference in the behavior of a <NumericFormat /> component.

Describe the expected behavior

I expect that leaving allowLeadingZeroes out of the component props, or explicitly setting it to false, would strip any leading zeroes from a number on blur.

Provide a CodeSandbox link illustrating the issue

See here. FYI, this is the CodeSandbox that is used in the documentation here.

Provide steps to reproduce this issue

  • Insert a NumericFormat component without the allowLeadingZeroes property, or set the property to false
  • Type in a string of 0s, followed by a number
  • Tab or click out of the input to remove focus

Please check the browsers where the issue is seen

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

This was issue on 5.2.0, and have been fixed with the newer release.
Thanks for pointing out, looks like documentation was not updated. Update the codesandbox to use the latest version 5.3.1.
https://codesandbox.io/s/allowleadingzeros-demo-ji97mv