From d190dc17b23049f812a2b146a100b23adf7cf404 Mon Sep 17 00:00:00 2001 From: Yomotsu Date: Sun, 28 Jul 2019 15:59:25 +0900 Subject: [PATCH 1/2] fix Japanese mobile phone number --- src/lib/isMobilePhone.js | 2 +- test/validators.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 39eca2cd5..0e3e39e04 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -58,7 +58,7 @@ const phones = { 'hu-HU': /^(\+?36)(20|30|70)\d{7}$/, 'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/, 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, - 'ja-JP': /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/, + 'ja-JP': /^(\+?81|0)[789]0[ \-]?\d{4}[ \-]?\d{4}$/, 'kk-KZ': /^(\+?7|8)?7\d{9}$/, 'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/, 'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/, diff --git a/test/validators.js b/test/validators.js index 1399c8dd2..1c755dc05 100644 --- a/test/validators.js +++ b/test/validators.js @@ -4779,9 +4779,11 @@ describe('Validators', () => { { locale: 'ja-JP', valid: [ - '09012345688', - '090 123 45678', - '+8190-123-45678', + '09012345678', + '08012345678', + '07012345678', + '090 1234 5678', + '+8190-1234-5678', ], invalid: [ '12345', @@ -4794,7 +4796,6 @@ describe('Validators', () => { '03_1234_5689', '0312345678', '0721234567', - '08002345678', '06 1234 5678', '072 123 4567', '0729 12 3456', From 5556e3b6a208c96699bd1bf83a001109069c578e Mon Sep 17 00:00:00 2001 From: Yomotsu Date: Sun, 28 Jul 2019 16:04:36 +0900 Subject: [PATCH 2/2] add 060 for ja-JP of isMobile --- src/lib/isMobilePhone.js | 2 +- test/validators.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 0e3e39e04..22694373d 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -58,7 +58,7 @@ const phones = { 'hu-HU': /^(\+?36)(20|30|70)\d{7}$/, 'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/, 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, - 'ja-JP': /^(\+?81|0)[789]0[ \-]?\d{4}[ \-]?\d{4}$/, + 'ja-JP': /^(\+?81|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/, 'kk-KZ': /^(\+?7|8)?7\d{9}$/, 'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/, 'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/, diff --git a/test/validators.js b/test/validators.js index 1c755dc05..69d8da7aa 100644 --- a/test/validators.js +++ b/test/validators.js @@ -4782,6 +4782,7 @@ describe('Validators', () => { '09012345678', '08012345678', '07012345678', + '06012345678', '090 1234 5678', '+8190-1234-5678', ],