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

getNumber() will return duplicated area code for certain NANP countries #1477

Closed
jmplahitko opened this issue Nov 17, 2023 · 3 comments
Closed

Comments

@jmplahitko
Copy link

Here is the list of affected NANP countries that I have found:

US Virgin Islands
British Virgin Islands
Northern Mariana Islands
Guam
American Samoa
Barbados
Cayman Islands
Bermuda
Grenada
St Lucia
Dominica
Saint Vincent and the Grenadines
Trinidad and Tobago

Steps to reproduce

  1. See this minimal reproduction repo: https://github.com/jmplahitko/intl-tel-input-test
  2. Start typing phone numbers for any of the countries listed below that I've found has the issue. Virgin Islands, for example, has area code 340

Expected behaviour

Phone numbers should be taken as typed. For example, all other NANP countries all work as expected.

Actual behaviour

After typing area code + prefix (ex. 3405555), the area code is duplicated in the getNumber() response (34034055555). Further attempts to backspace the number to correct it will result in the area code being duplicated again (34034034055) as if in a loop.

Initialisation options

No initialization options (utils are imported as a sideaffect for sake of the demo)

@jmplahitko
Copy link
Author

Any ideas regarding this issue?

@jackocnr
Copy link
Owner

jackocnr commented Dec 7, 2023

As per the readme, getNumber should only be used with a valid number. Are you checking isValidNumber before you use it? That might be the problem. If I check the demo site and select US Virgin Islands, and type a valid number, like 3405555555 then getNumber is working fine. Let me know if I've misunderstood something.

@jackocnr
Copy link
Owner

Closing due to inactivity.

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

No branches or pull requests

2 participants