-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix decimalSeparator with a suffix containing more than one character #743
Fix decimalSeparator with a suffix containing more than one character #743
Conversation
Apparently this change break some tests, could you @s-yadav check this out? EDIT: made a small fix, now all tests pass |
I noticed that my fix works only if decimal separator is the first char we type into. In other cases startIndex should be one greater. We can check if allowed decimal separator was used by adding boolean flag, something like this:
This, however, break the tests, and I'm unsure if it break functionality in some other cases. |
Hey @sormpe Thanks for PR. couldn't look into this earlier, will check this. |
As this was incorporated with some other fix. closing the PR. |
Describe the issue/change
This PR fixes issue described in #725
Describe the changes proposed/implemented in this PR
As romanopassalacqua suggested, we now check if char is in allowedDecimalSeparators in getCaretPosition. Before we only checked if chars were the same resulting that indexMap was not affected. This caused problem described in #725 when using some of the allowedDecimalSeparators which is not (default) decimalSeparator.
Link Github issue if this PR solved an existing issue
#725
Example usage (If applicable)
Video
react-number-format-fix.mp4
Please check which browsers were used for testing