Browse Source

Update phone.js

Add Thailand Mobile phone number format
Yote 11 years ago
parent
commit
bae8cefd1c
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/js/validator/phone.js

+ 6 - 1
src/js/validator/phone.js

@@ -23,7 +23,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['BR', 'CN', 'ES', 'FR', 'GB', 'MA', 'PK', 'RO', 'US'],
+        COUNTRY_CODES: ['BR', 'CN', 'ES', 'FR', 'GB', 'MA', 'PK', 'TH', 'RO', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -106,6 +106,11 @@
                     isValid = (/^0?3[0-9]{2}[0-9]{7}$/).test(value);
                     break;
                     
+        		case 'TH':
+        		    //http://regex101.com/r/vM5mZ4/2
+        		    isValid = (/^0\(?([8-9]{2})*-([0-9]{3})*-([0-9]{4}))$/g).test(value);
+                    break;                     
+                    
         		case 'RO':
         		    // All mobile network and land line
         		    isValid = (/^(\+4|)?(07[0-8]{1}[0-9]{1}|02[0-9]{2}|03[0-9]{2}){1}?(\s|\.|\-)?([0-9]{3}(\s|\.|\-|)){2}$/g).test(value);