mobi / telephone_number

Phone number validation for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

invalid number that is valid

ezijlstra opened this issue · comments

TelephoneNumber.parse('+543801234567', :ar).valid?
=> false

Tested with version 1.4.9 and 1.4.8

Numberjacki.io says this is a valid number..

Hey there @ezijlstra, thanks for opening this issue!

One update that needs to be made on the readme is that Numberjack is outdated when it comes to validations. With that said, we use Google's metadata as our source of truth, so a good way to test if the number should be valid or not is to use Google's demo, which can be found here https://libphonenumber.appspot.com/.

For this example, if you pass in the information into Google's demo, you get the following result:

https___libphonenumber_appspot_com_phonenumberparser_number__2B543801234567_country_AR

The number is possible, but not for this region, so for the TelephoneNumber gem, we're expecting false as well. If you need that number to be valid for this region, I would recommend building an override file that you can use locally. Some more information can be found here: https://github.com/mobi/telephone_number#override-file.

Thanks!