daddyz/phonelib

Valid US Phone Number reporting as invalid

tesshead-dox opened this issue · 5 comments

I'm using phonelib v0.8.5 and trying to validate these three numbers:

2276310344
3696441631
3697958630

If I run them through the google libphonenumber that this gem is based on they appear as valid, however this phonelib gem states they're invalid. Area code 227 is Maryland and 369 is California. Adding a 1 to the number value did not fix the issue either.

example:

dev [10] pry(main)> Phonelib.parse(3696441631).valid_for_country?("US")
=> false
dev [11] pry(main)> Phonelib.parse(2276310344).valid_for_country?("US")
=> false
dev [12] pry(main)> Phonelib.parse(3697958630).valid_for_country?("US")
=> false

Is the script to import data from libphonenumber included in this repo? I also encountered issues with 227 numbers, and confirmed that it was recently added to libphonenumber. I'd like to update the data in my application, and open a PR here if you would like, but I don't see instructions in the readme. cc @jtangqt

@bergey I haven't tried this, but I see that there is a rake task for updating: https://github.com/daddyz/phonelib/blob/master/lib/tasks/phonelib_tasks.rake

Thanks! That worked: #291