浏览代码

Add Country name into phone.js

Add missing country name
Yote 11 年之前
父节点
当前提交
d988c25d4f
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      src/js/validator/phone.js

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

@@ -12,6 +12,7 @@
             MA: 'Morocco',
             PK: 'Pakistan',
             RO: 'Romania',
+            TH: 'Thailand',
             US: 'USA'
         }
     });
@@ -23,7 +24,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['BR', 'CN', 'ES', 'FR', 'GB', 'MA', 'PK', 'TH', 'RO', 'US'],
+        COUNTRY_CODES: ['BR', 'CN', 'ES', 'FR', 'GB', 'MA', 'PK', 'RO', 'TH', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -106,15 +107,15 @@
                     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);
                     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 'US':
                 /* falls through */