Skip to content
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

Bug fix: Bypass formatNumber if user is deleting #313

Merged
merged 2 commits into from
Feb 29, 2020

Conversation

Kongfujonstew
Copy link
Contributor

https://www.loom.com/share/a4d1e5295b0341ecb3da4a2c019e32b4

Description

** Pls see the video. This PR potentially fixes the following bug:

For some localities (I've only identified Russia), when a user deletes numbers window.intlTelInputUtils.formatNumber behaves incorrectly.

window.intlTelInputUtils.formatNumber('8 (444) 444-44-4', 'ru', 2) ==> "8 (844) 444-44-44"
window.intlTelInputUtils.formatNumber('8 (844) 444-44-4', 'ru', 2) ==> "8 (884) 444-44-44"
window.intlTelInputUtils.formatNumber('8 (884) 444-44-4', 'ru', 2) ==> "8 (888) 444-44-44"
window.intlTelInputUtils.formatNumber('8 (888) 44-44-4', 'ru', 2) ==> "8 (888) 844-44-44"
window.intlTelInputUtils.formatNumber('8 (888) 84-44-4', 'ru', 2) ==> "8 (888) 884-44-44"

. . . and so on, until all digits are '8'.

Screenshots (if appropriate):

See video above

Types of changes

Adds a check on IntlTelInput -> If user has deleted from input val, do not perform a format.

Checklist:

  • I have used ESLint & Prettier to follow the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 93.677% when pulling d212b78 on Kongfujonstew:fix-delete-err into ca6e3e0 on patw0929:master.

@patw0929
Copy link
Owner

LGTM! Thank you so much! ❤️

@patw0929 patw0929 merged commit 02e635d into patw0929:master Feb 29, 2020
@patw0929
Copy link
Owner

patw0929 commented Mar 4, 2020

Published as v7.1.1.

@patw0929
Copy link
Owner

patw0929 commented Mar 7, 2020

🎉 This PR is included in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

andrewsantarin pushed a commit to andrewsantarin/react-intl-tel-input that referenced this pull request Feb 2, 2022
Bug fix: Bypass formatNumber if user is deleting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants