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.8k stars 216 forks source link

When using AsYouType with US Country code, if number starts with 1 it formats incorrectly. #436

Closed mistyframpton closed 1 year ago

mistyframpton commented 1 year ago

If I use AsYouType like so: const formattedNum = new AsYouType('US').input('1234567890), it looks like it is viewing the first '1' to be the country code. So, it formats it like '1 (234) 567-890' when I am expecting it to be '(123) 456-7890'. Is there something I am missing where we can specify that we only want the national format?

catamphetamine commented 1 year ago

No, 1 is a national prefix in US.