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

A bit strange behavior of the parser when determining the country code #315

Open
Viktor-Ivliev opened this issue Sep 26, 2024 · 1 comment

Comments

@Viktor-Ivliev
Copy link

 Phonelib.parse('(249) 209-7272').country => "US"   - returned default
 Phonelib.parse('(249) 209-7272').valid_countries => []
 Phonelib.parse(Phonelib.parse('(249) 209-7272').e164).country => "CA"  - returned correct value

Why can't we try to identify the country after formatting the number?

Versions:

  phonelib (0.9.2)
  phonelib (0.8.8)
@daddyz
Copy link
Owner

daddyz commented Oct 27, 2024

@Viktor-Ivliev sounds similar to #262 (comment) since I understand that you define US as default country.
Try to define several default countries and then it will work:

Phonelib.default_country = [:us, :ca]

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