phonelib icon indicating copy to clipboard operation
phonelib copied to clipboard

Some numbers are formatted incorrectly

Open arpadlukacs opened this issue 5 years ago • 3 comments

Phonelib.parse("5141111111").national
=> "(041) 111111"

I would expect the result to be (514) 111-1111

arpadlukacs avatar Feb 10 '20 22:02 arpadlukacs

@arpadlukacs This number is parsed as Peru, is this a correct country?

daddyz avatar Feb 11 '20 07:02 daddyz

No, the country is US, so the full number is +1 (514) 111-1111 For the record, when I add the "US" parameter to the parse method, it returns the number as it is, but without any formatting:

Phonelib.parse("514-111-1111","US").national
=> "5141111111"

arpadlukacs avatar Feb 11 '20 08:02 arpadlukacs

This number is not parsed as valid number (even on original libphonenumber), so it doesn't get formatted.

daddyz avatar Oct 13 '20 14:10 daddyz