catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.79k stars 216 forks source link

Does not parse GB properly without + #298

Closed rtaft closed 5 years ago

rtaft commented 5 years ago

Using the input '441843297700' and the default country US, it fails to ID this as UK and flags it as invalid. Setting the country to GB also flags it as invalid and appends +44 to the front. This only works properly if there is a + in the front, which my data source does not have.

catamphetamine commented 5 years ago

which my data source does not have.

Your data source is invalid.

rtaft commented 5 years ago

Setting the country code to GB should handle it properly, Googles version does. This appends an extra +44 to it. The data source is a number, not a string...like a real phone.

catamphetamine commented 5 years ago

This appends an extra +44 to it.

Valid local numbers are parsed correctly. You're talking about invalid numbers.