daddyz / phonelib

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

Australian landline numbers beginning with 08. #257

Closed thomashexton closed 9 months ago

thomashexton commented 2 years ago

Thank you for a great gem. It's got my back a lot, but I've been unsuccessful in finding a solution to my following issue. And to be honest, I'm not able to work out if it's a bug in phonelib or something related to Google's libphonenumber? (And if it is the latter, I've also been unsuccessful in finding some docs to explain how to overwrite the libphonenumner locally, as this Gem's README specifies I can do (via Phonelib.override_phone_data method).

From my testing, all of the Australian landline state prefix codes 02, 03, 04, 07 (as defined by Government) work except for the 08 prefix.

Working AUS code example: ✅

Phonelib.parse("(07) 4444 0008").national
> "(07) 4444 0008"
Phonelib.parse("(07) 4444 0008").e164
>  "+61744440008"

Broken AUS code example: ❌

Phonelib.parse("(08) 4444 0008").national
> "844440008"
Phonelib.parse("(08) 4444 0008").e164
> "+610844440008" # please note: additional 0 just after the +61

Any help would be appreciated.

daddyz commented 2 years ago

@thomashexton I updated data of the gem, but it's still being parsed incorrectly. Check section describing parsing issue. You can open issue for libphonenumber or just add additional regexes for AUS in initializer.