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

international parsing fails on 8 digit indian numbers #169

Open
danborden1 opened this issue Jun 19, 2019 · 2 comments
Open

international parsing fails on 8 digit indian numbers #169

danborden1 opened this issue Jun 19, 2019 · 2 comments
Labels
missing validation data data for some prefix/country is missing in the souce

Comments

@danborden1
Copy link

danborden1 commented Jun 19, 2019

similar to issue 168, 8 digit indian phone numbers do not parse properly, whereas 10 digit indian phone numbers parse correctly. Please note that the country code is prepended twice on 8 digit indian phone numbers,

`2.3.6 :021 > Phonelib.parse('911234567890').international

=> "+91 1234 567 890"

2.3.6 :022 > Phonelib.parse('9112345678').international

=> "+91 91123 45678" `

@danborden1
Copy link
Author

In rails, this behavior can be fixed by adding Phonelib.strict_double_prefix_check = true to config/initializers/phonelib.rb

@daddyz
Copy link
Owner

daddyz commented Jun 27, 2019

@chiefjuss number 9112345678 is not valid by google's regex.

Phonelib.parse('+9112345678').valid? # => false

Since number is not valid, for countries with option to have double country prefix, library tries to add additional country prefix and reparse, and in case it's valid, the new number will be returned. So your suggestion is not good. You need to open an issue in original google lib. You can check that it fails here

@daddyz daddyz added the missing validation data data for some prefix/country is missing in the souce label Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing validation data data for some prefix/country is missing in the souce
Projects
None yet
Development

No branches or pull requests

2 participants