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

Not getting the full dial code from Dominican Republic/Bahamas/Puerto Rico numbers #220

Open
AdamJacobson opened this issue Mar 5, 2021 · 2 comments

Comments

@AdamJacobson
Copy link

Parsing a valid DO number does return 'DO' as the country:

2.7.2 :031 > Phonelib.parse("+1 809-538-0020").country
 => "DO"

But the country_code for dialing is simply returned as '1' which is the same for US/CA making country information lookups using this data problematic. Twilio specifically gives ["+1829", "+1809", "+1849"] as the possible codes for DO.

2.7.2 :032 > Phonelib.parse("+1 809-538-0020").country_code
 => "1"

Is this a bug or is there a better way to get the full dial code that I am not aware of? I've noticed similar problems with other countries that have the dial code start with '1', including Bahamas and Puerto Rico.

@daddyz
Copy link
Owner

daddyz commented Mar 21, 2021

@AdamJacobson this gem's data is based on google libphonenumber and it has "1" as country code since it is required for proper parsing, I will try to find a way to solve your issue.

@philihp
Copy link

philihp commented Jun 9, 2021

please ensure that Puerto Rico phone numbers are still part of the US. ❤️

Phonelib.parse("+1 787-671-1234").country_code
=> "US"

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

No branches or pull requests

3 participants