|
@@ -25,6 +25,9 @@
|
|
|
options.country = options.country || 'US';
|
|
options.country = options.country || 'US';
|
|
|
switch (options.country.toUpperCase()) {
|
|
switch (options.country.toUpperCase()) {
|
|
|
case 'US':
|
|
case 'US':
|
|
|
|
|
+ // Make sure US phone numbers have 10 digits
|
|
|
|
|
+ value = value.replace(/\(|\)|\s+/g, '');
|
|
|
|
|
+ return (/^(?:1\-?)?(\d{3})[\-\.]?(\d{3})[\-\.]?(\d{4})$/).test(value) && value.length == 10;
|
|
|
default:
|
|
default:
|
|
|
value = value.replace(/\(|\)|\s+/g, '');
|
|
value = value.replace(/\(|\)|\s+/g, '');
|
|
|
return (/^(?:1\-?)?(\d{3})[\-\.]?(\d{3})[\-\.]?(\d{4})$/).test(value);
|
|
return (/^(?:1\-?)?(\d{3})[\-\.]?(\d{3})[\-\.]?(\d{4})$/).test(value);
|