This commit is contained in:
陆柯 2023-06-18 20:08:13 +08:00
parent ea085bc226
commit 37b5e1bea2
2 changed files with 13 additions and 9 deletions

View File

@ -769,7 +769,9 @@ module.exports = {
namefull: { enUS: "the People's Republic of China", zhCN: '中华人民共和国' }, namefull: { enUS: "the People's Republic of China", zhCN: '中华人民共和国' },
notes: notes:
'“GB/T 2659-2000”的“CN”适用于整个中华人民共和国辖区包括中国大陆、香港、澳门。而“ISO 3166-1”和“CNS 12842”的“CN”则仅适用于中国大陆不含港澳地区。', '“GB/T 2659-2000”的“CN”适用于整个中华人民共和国辖区包括中国大陆、香港、澳门。而“ISO 3166-1”和“CNS 12842”的“CN”则仅适用于中国大陆不含港澳地区。',
reCallnumber: /^1\d{10}$/.source, phoneRegex: /^1\d{10}$/.source,
phoneMaxlen: 11,
phoneMinlen: 11,
timezone: '0', timezone: '0',
}, },
CO: { CO: {
@ -1832,7 +1834,7 @@ module.exports = {
name: { enUS: 'Japan', native: '日本', zhCN: '日本', zhHK: '日本', zhTW: '日本' }, name: { enUS: 'Japan', native: '日本', zhCN: '日本', zhHK: '日本', zhTW: '日本' },
namefull: { enUS: '', zhCN: '日本国' }, namefull: { enUS: '', zhCN: '日本国' },
notes: '', notes: '',
reCallnumber: /^\d{10}$/.source, phoneRegex: /^\d{10,11}$/.source,
timezone: '1', timezone: '1',
}, },
KE: { KE: {
@ -3184,7 +3186,7 @@ module.exports = {
name: { enUS: 'Singapore', zhCN: '新加坡', zhHK: '新加坡', zhTW: '新加坡' }, name: { enUS: 'Singapore', zhCN: '新加坡', zhHK: '新加坡', zhTW: '新加坡' },
namefull: { enUS: 'the Republic of Singapore', zhCN: '新加坡共和国' }, namefull: { enUS: 'the Republic of Singapore', zhCN: '新加坡共和国' },
notes: '', notes: '',
reCallnumber: /^[89]\d{7}$/.source, phoneRegex: /^[89]\d{7}$/.source,
timezone: '0', timezone: '0',
}, },
SH: { SH: {
@ -3746,7 +3748,9 @@ module.exports = {
name: { enUS: 'United States', zhCN: '美国', zhHK: '美国', zhTW: '美国' }, name: { enUS: 'United States', zhCN: '美国', zhHK: '美国', zhTW: '美国' },
namefull: { enUS: 'the United States of America', zhCN: '美利坚合众国' }, namefull: { enUS: 'the United States of America', zhCN: '美利坚合众国' },
notes: '', notes: '',
reCallnumber: /^\d{10}$/.source, phoneRegex: /^\d{10}$/.source,
phoneMaxlen: 10,
phoneMinlen: 10,
timezone: '-13', timezone: '-13',
}, },
UY: { UY: {

View File

@ -3,16 +3,16 @@ const landSet = require('./i18n-lands.js')
module.exports = { module.exports = {
validate_phone ({ phone } = {}) { validate_phone ({ phone } = {}) {
try { try {
let [fullphone, itc, callnumber] = /^\+(\d{1,3})-(\d{7,11})$/.exec(phone) let [fullphone, itc, callnumber] = /^\+(\d{1,3})-(\d{7,12})$/.exec(phone)
switch (itc) { switch (itc) {
case landSet.CN.itc: case landSet.CN.itc:
return new RegExp(landSet.CN.reCallnumber).test(callnumber) return new RegExp(landSet.CN.phoneRegex).test(callnumber)
case landSet.JP.itc: case landSet.JP.itc:
return new RegExp(landSet.JP.reCallnumber).test(callnumber) return new RegExp(landSet.JP.phoneRegex).test(callnumber)
case landSet.SG.itc: case landSet.SG.itc:
return new RegExp(landSet.SG.reCallnumber).test(callnumber) return new RegExp(landSet.SG.phoneRegex).test(callnumber)
case landSet.US.itc: case landSet.US.itc:
return new RegExp(landSet.US.reCallnumber).test(callnumber) return new RegExp(landSet.US.phoneRegex).test(callnumber)
default: default:
return true return true
} }