AfterShip / phone

With a given country and phone number, validate and reformat the mobile phone number to the E.164 standard. The purpose of this is to allow us to send SMS to mobile phones only.

Home Page:https://www.aftership.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing "+17878787" as "AIA"?

domkm opened this issue · comments

phone("+17878787") // ["+17878787", "AIA"]

It looks like this shouldn't happen because Anguilla numbers begin with "+1 264". Is this a bug?

+1 787 / 939 Puerto Rico
I also double check and fix the following location

+1 United States, including United States territories:
+1 340 United States Virgin Islands
+1 670 Northern Mariana Islands
+1 671 Guam
+1 684 American Samoa
+1 787 / 939 Puerto Rico

+1 Many, but not all, Caribbean nations and some Caribbean Dutch and British Overseas Territories:
+1 242 Bahamas
+1 246 Barbados
+1 264 Anguilla
+1 268 Antigua and Barbuda
+1 284 British Virgin Islands
+1 345 Cayman Islands
+1 441 Bermuda
+1 473 Grenada
+1 649 Turks and Caicos Islands
+1 664 Montserrat
+1 721 Sint Maarten <-- Newly added
+1 758 Saint Lucia
+1 767 Dominica
+1 784 Saint Vincent and the Grenadines
+1 809 / 829 / 849 Dominican Republic
+1 868 Trinidad and Tobago
+1 869 Saint Kitts and Nevis
+1 876 Jamaica

Notice that phone("+17878787") should be an invalid phone number (no matter mobile or land)
as +1 787 XXXX YYY total should be 11 digits.