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

Canadian area code 226 included in array of US area codes #2321

Closed
jgarber623 opened this issue May 13, 2021 · 0 comments
Closed

Canadian area code 226 included in array of US area codes #2321

jgarber623 opened this issue May 13, 2021 · 0 comments

Comments

@jgarber623
Copy link
Contributor

Describe the bug

The Canadian area code 226 is erroneously included in the array of US area codes in lib/locales/en-US.yml (see line 92). This can be problematic when using Faker to generate US-specific phone numbers (withFaker::Config.locale = 'en-US') which are then validated using other tools (such as the telephone_number gem).

With the existing array of area codes in the en-US locale, extremely occasionally, Faker will generate a logically invalid US phone number (e.g. +12262011212).

To Reproduce

Since this is a locale-specific issue, reproducing it directly is somewhat difficult. Using a phone number string like +12262011212, which would be generated by Faker (withFaker::Config.locale = 'en-US'), you may observe that the phone number is determined to be invalid:

pry(main)> require 'telephone_number'
=> true
pry(main)> TelephoneNumber.parse('+12262011212').valid?
=> false

Please let me know if there are more direct ways of generating a phone number with the specific, invalid (in the context of the en-US locale, that is) area code.

Expected behavior

The Canadian area code 226 should not be included in the array of US area codes.

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