ianks / mini_phone

A fast phone number parser, validator and formatter for Ruby. This gem binds to Google's C++ libphonenumber for spec-compliance and performance.
MIT License
160 stars 8 forks source link

Invalid country being returned for Virgin Islands #12

Open tsaifi9 opened 2 years ago

tsaifi9 commented 2 years ago

Running into an issue with validating numbers from Virgin Islands

Problem:

Expectation:

Setup:

virgin_islands_phone_number = "+13407759575"
phone = MiniPhone.parse(virgin_islands_phone_number)

phone.valid? # => false
p.country # => "US"

MiniPhone.valid_for_country?(virgin_islands_phone_number, 'VI') # true
espen commented 1 year ago

I think this is an issue with libphonenumber returning +1 as country code. See https://libphonenumber.appspot.com/phonenumberparser?number=%2B13407759575