Bug 858339 - PhoneNumberJS: Fix colombian phone numbers without the leading +. r=bent

This commit is contained in:
Gregor Wagner 2013-04-04 17:40:04 -07:00
parent d27ce43bfe
commit 3918b9d59a
2 changed files with 8 additions and 5 deletions

View File

@ -363,17 +363,17 @@ this.PhoneNumber = (function (dataBase) {
if (ret) if (ret)
return ret; return ret;
// If the number matches the possible numbers of the current region,
// return it as a possible number.
if (md.possiblePattern.test(number))
return new NationalNumber(md, number);
// Now lets see if maybe its an international number after all, but // Now lets see if maybe its an international number after all, but
// without '+' or the international prefix. // without '+' or the international prefix.
ret = ParseInternationalNumber(number) ret = ParseInternationalNumber(number)
if (ret) if (ret)
return ret; return ret;
// If the number matches the possible numbers of the current region,
// return it as a possible number.
if (md.possiblePattern.test(number))
return new NationalNumber(md, number);
// We couldn't parse the number at all. // We couldn't parse the number at all.
return null; return null;
} }

View File

@ -283,6 +283,9 @@ Format("0997654321", "CL", "997654321", "CL", "(99) 765 4321", "+56 99 765 4321"
// Chile mobile number from another mobile number // Chile mobile number from another mobile number
Format("997654321", "CL", "997654321", "CL", "(99) 765 4321", "+56 99 765 4321"); Format("997654321", "CL", "997654321", "CL", "(99) 765 4321", "+56 99 765 4321");
// Colombian international number without the leading "+"
Format("5712234567", "CO", "12234567", "CO", "(1) 2234567", "+57 1 2234567");
// Dialing 911 in the US. This is not a national number. // Dialing 911 in the US. This is not a national number.
CantParse("911", "US"); CantParse("911", "US");