catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript

Home Page:https://catamphetamine.gitlab.io/libphonenumber-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mistyframpton opened this issue · comments

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?

No, 1 is a national prefix in US.