daddyz / phonelib

Ruby gem for phone validation and formatting using google libphonenumber library data
MIT License
1.04k stars 130 forks source link

Problem validating a French telephone with prefix +3369... #246

Closed jfernandezrico closed 2 years ago

jfernandezrico commented 2 years ago

Hello,

I have an issue with a French phone number that starts with +3369. I could see that for +336[0..8] there is no problem. Maybe it's a new number and 69 are not added to the data yet.

Kind regards

jfernandezrico commented 2 years ago

Maybe it's not a valid prefix, and the good one is +59069.... which belongs to Guadalupe.

aturay commented 2 years ago

Phonelib.add_additional_regex :fr, Phonelib::Core::MOBILE, '69\d{7}'

daddyz commented 2 years ago

@aturay thanks for help. @jfernandezrico yes, it's the only way to solve it right now, you can open an issue for google libphonenumber team to fix the data

n-b commented 2 years ago

The +33 6 9X XX XX XX numbers are actually reserved for ultramarine territories (Guadeloupe, La Réunion, Martinique, Guyane, and Mmayotte). In phonelib, those are treated as different countries from FR. (Actually it’s in libphonenumber). (Actually actually, it’s in the ARCEP Plan national de numérotation téléphonique).

I believe this is the same issue as Puerto Rico (#75), and that the correct fix is to try multiple country codes instead of a single default_country. I used to do exactly this, but phonelib 0.7.0 that just came out seems to allow several default_countries. Thants @daddyz !

daddyz commented 2 years ago

@n-b glad to hear that