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

Switching countries changes phone numbers incorrectly #22

Open
jsshapiro opened this issue Jul 26, 2020 · 3 comments
Open

Switching countries changes phone numbers incorrectly #22

jsshapiro opened this issue Jul 26, 2020 · 3 comments
Labels

Comments

@jsshapiro
Copy link

Current behavior

When switching countries, at vue-tel-input-vuetify.vue#571, the code incorrectly uses the .national version of the phone number rather than the .significant version. There is no sensible scenario, when switching countries, where we would want to preserve the local-dialing prefix that is included in the .national version of the phone number. This bug is inherited from upstream, and I have filed a bug there as well.

Repeat by:

  1. Select Algeria as your country, and enter the awesome-phonenumber example phone number, which is +355 22 345 678.
  2. Change the country to USA.
  3. Observe that you get an area code starting with a '0', which is an illegal area code under the NANPA rules.

What has happened is that the leading zero added for local dialing in Algeria has been added to the number because .national was used rather than .significant.

Expected behavior

Expected behavior is that the leading zero that is only significant for in-nation dialing within Algeria does not contaminate the phone number after switching countries.

The use-case is that the user has started keying a phone number, realizes that they have the wrong country selected, and changes the country drop-down to select the intended country. This should not alter the numbers they have typed.

Versions

Problem observed in v1.2.11, but since this looks to be inherited from up-stream, I suspect it's a long-term issue.

Environment:

Problem is environment-independent.

Recommended Fix

The recommended fix is to change the code to use .significant rather than .national. Note that in all cases where .national has been set, .significant has also been set.

@QADRAX
Copy link

QADRAX commented Jul 27, 2020

I've the same issue!

@yogakurniawan yogakurniawan reopened this Jul 28, 2020
github-actions bot pushed a commit that referenced this issue Jul 28, 2020
## [1.2.12](v1.2.11...v1.2.12) (2020-07-28)

### Bug Fixes

* **component:** fix issue switching countries ([bf6e26e](bf6e26e)), closes [#22](#22)
@github-actions
Copy link

🎉 This issue has been resolved in version 1.2.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

@yogakurniawan
Copy link
Owner

@jsshapiro
thanks a lot for raising this issue.
i have add fix for this and it's now fixed in version 1.2.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants