maximumFractionDigits causing strange behaviour
daniloak opened this issue · comments
Describe the issue and the actual behavior
I follow the same example in the documentation using NumberFormatBase but removed maximumFractionDigits, if I type 1, it formats to "1,00", type 1 again, it formats to 1.100,00
Describe the expected behavior
I was expecting not to add multiples zeros when I type any digit
Provide a CodeSandbox link illustrating the issue
https://codesandbox.io/s/custom-numeric-format-forked-tm9mmg
Provide steps to reproduce this issue
Select all the input, type 1, see the zeros growing, looks like for each number it adds another zero
Please check the browsers where the issue is seen
- Chrome
- Chrome (Android)
- Safari (OSX)
- Safari (iOS)
- Firefox
- Firefox (Android)
- Edge
The custom numeric format example with Intl.NumberFormat
is to support very basic case as mentioned on doc. If you are having decimals, then you may also have to provide removeFormatting logic.
But instead I will suggest to just use NumericFormat component from the library, it handles all this cases.