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

Some North American countries receive incorrect National Format when removing digits #451

Open
meevo-ccaporrimo opened this issue Jan 11, 2024 · 0 comments

Comments

@meevo-ccaporrimo
Copy link

Issue: When one of the affected area codes is used to populate a phone number and user backspaces to remove digits, if the backspace would cause phone number length to be 7 digits, regex pattern causes the "national format" to output with the area code duplicated.

The metadata regex patterns for the affected countries may be at fault. Their country code is actually +1 (North America) and the "area code" is the following 3 digits. Regex pattern should probably use pattern length of 10 for these to allow for the "area code" to be part of the full phone number (similar to Canada, US, Dominican Republic etc). Our findings show the regex has length of 7. Making the adjustment manually in the metadata file did stop this from happening.

Here's an example for American Samoa using appspot
https://libphonenumber.appspot.com/phonenumberparser?number=6845551&country=AS
image

The metadata file has this entry for American Samoa:
"AS":["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"]

The regex pattern we tested changing was ([267]\\d{6})$|1 which we changed to ([267]\\d{9})$|1 and the problem did not occur again

Full list of affected dialing codes / countries:

  • 1684 (American Samoa)
  • 1264 (Anguilla)
  • 1268 (Antigua and Barbuda)
  • 1246 (Barbados)
  • 1441 (Bermuda)
  • 1284 (British Virgin Islands)
  • 1345 (Cayman Islands)
  • 1767 (Dominica)
  • 1473 (Grenada)
  • 1671 (Guam)
  • 1670 (Northern Mariana Islands)
  • 1758 (Saint Lucia)
  • 1784 (St Vincent and the Grenadines)
  • 1868 (Trinidad & Tobago)
  • 1340 (US Virgin Islands)
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

1 participant