dongri / phonenumber

With a given country and phone number, validate and format the MOBILE phone number to E.164 standard
MIT License
186 stars 46 forks source link

Calling GetISO3166ByNumber() with withLandline=true break it for Canadian phone numbers #23

Closed haizaar closed 1 year ago

haizaar commented 2 years ago

US and CA have the same country code, hence if you call GetISO3166ByNumber() with withLandline=true it will always return US even for Canadian mobile numbers - as per https://github.com/dongri/phonenumber/blob/master/phonenumber.go#L106

To fix this, I suggest the library code to be reworked to match the longest matching prefix of country_code+mobile_prefix.

4rakcheev commented 2 years ago

Fixed by PR https://github.com/dongri/phonenumber/pull/29

4rakcheev commented 1 year ago

@haizaar @dongri could you please close the issue?