daddyz / phonelib

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

valid_for_country giving true for 8 digit Indian mobile number #277

Closed abhispares closed 1 year ago

abhispares commented 1 year ago

example: Phonelib.valid_for_country?("88097679","IN"). => true. {which is incorrect}

whereas

Phonelib.valid_for_country?("+9188097679","IN"). => false. {which is correct}

Screenshot 2023-03-31 at 11 42 07 AM Screenshot 2023-03-31 at 11 42 41 AM Screenshot 2023-03-31 at 11 43 58 AM
abhispares commented 1 year ago

Any updates on it?

daddyz commented 1 year ago

@abhispares the issue appears due to possible double country prefix

Phonelib.parse("88097679","IN").international # => "+91 91880 97679" 
Phonelib.parse("9188097679","IN").international # => "+91 91880 97679"

But in case of + in the beginning, it's not added. The behaviour is not ok to add it twice, I will look into it

daddyz commented 1 year ago

@abhispares just released new v0.8.1 with the fix