From c027e10e9b74dc8a1d1a9cfa5b385ea1224ac489 Mon Sep 17 00:00:00 2001 From: vfarylevych Date: Sat, 13 Jan 2024 16:59:13 +0200 Subject: [PATCH 1/4] fix(isMobilePhone): update phone regex for Ukraine uk-UA --- src/lib/isMobilePhone.js | 2 +- test/validators.test.js | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 7c9b420e9..d3cf84971 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -150,7 +150,7 @@ const phones = { 'th-TH': /^(\+66|66|0)\d{9}$/, 'tr-TR': /^(\+?90|0)?5\d{9}$/, 'tk-TM': /^(\+993|993|8)\d{8}$/, - 'uk-UA': /^(\+?38|8)?0\d{9}$/, + 'uk-UA': /^(\+?38)?0(50|63|66|67|68|73|91|92|93|94|95|96|97|98|99)\d{7}$/, 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/, 'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/, 'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/, diff --git a/test/validators.test.js b/test/validators.test.js index 6c68cd71a..34500217f 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -9303,16 +9303,31 @@ describe('Validators', () => { { locale: 'uk-UA', valid: [ - '+380982345679', + '+380501234567', + '+380631234567', + '+380661234567', + '+380671234567', + '+380681234567', + '+380731234567', + '+380911234567', + '+380921234567', + '+380931234567', + '+380941234567', + '+380951234567', + '+380961234567', + '+380971234567', + '+380981234567', + '+380991234567', '380982345679', - '80982345679', '0982345679', ], invalid: [ '+30982345679', '982345679', + '80982345679', '+380 98 234 5679', '+380-98-234-5679', + '+380 (98) 234-56-79', '', 'ASDFGJKLmZXJtZtesting123', '123456', From 4378c01a15371cda7077a9e859dc6ff4772866bd Mon Sep 17 00:00:00 2001 From: Volodymyr Farylevych <88475172+arttiger@users.noreply.github.com> Date: Mon, 15 Jan 2024 08:36:26 +0200 Subject: [PATCH 2/4] Add some tests --- test/validators.test.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/test/validators.test.js b/test/validators.test.js index 34500217f..eb0a7ee04 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -9318,11 +9318,41 @@ describe('Validators', () => { '+380971234567', '+380981234567', '+380991234567', - '380982345679', - '0982345679', + '380501234567', + '380631234567', + '380661234567', + '380671234567', + '380681234567', + '380731234567', + '380911234567', + '380921234567', + '380931234567', + '380941234567', + '380951234567', + '380961234567', + '380971234567', + '380981234567', + '380991234567', + '0501234567', + '0631234567', + '0661234567', + '0671234567', + '0681234567', + '0731234567', + '0911234567', + '0921234567', + '0931234567', + '0941234567', + '0951234567', + '0961234567', + '0971234567', + '0981234567', + '0991234567', ], invalid: [ '+30982345679', + '+380321234567', + '+380441234567', '982345679', '80982345679', '+380 98 234 5679', From 17b8d97e256cd805b9e59107be9c09af28f6d506 Mon Sep 17 00:00:00 2001 From: Volodymyr Farylevych <88475172+arttiger@users.noreply.github.com> Date: Wed, 8 May 2024 10:41:13 +0300 Subject: [PATCH 3/4] Update isMobilePhone.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minor suggestion to reduce the length of the expression аnd add two new mobile operators --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index d3cf84971..03afd6dc5 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -150,7 +150,7 @@ const phones = { 'th-TH': /^(\+66|66|0)\d{9}$/, 'tr-TR': /^(\+?90|0)?5\d{9}$/, 'tk-TM': /^(\+993|993|8)\d{8}$/, - 'uk-UA': /^(\+?38)?0(50|63|66|67|68|73|91|92|93|94|95|96|97|98|99)\d{7}$/, + 'uk-UA': /^(\+?38)?0(50|6[36-8]|7[357]|9[1-9])\d{7}$/, 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/, 'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/, 'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/, From 521e7c38534808e7e8ae72d9f36e8d1ec4b4c5f0 Mon Sep 17 00:00:00 2001 From: Volodymyr Farylevych <88475172+arttiger@users.noreply.github.com> Date: Wed, 8 May 2024 13:22:05 +0300 Subject: [PATCH 4/4] Add some tests --- test/validators.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/validators.test.js b/test/validators.test.js index eb0a7ee04..fa976b6c2 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -9309,6 +9309,8 @@ describe('Validators', () => { '+380671234567', '+380681234567', '+380731234567', + '+380751234567', + '+380771234567', '+380911234567', '+380921234567', '+380931234567', @@ -9324,6 +9326,8 @@ describe('Validators', () => { '380671234567', '380681234567', '380731234567', + '380751234567', + '380771234567', '380911234567', '380921234567', '380931234567', @@ -9339,6 +9343,8 @@ describe('Validators', () => { '0671234567', '0681234567', '0731234567', + '0751234567', + '0771234567', '0911234567', '0921234567', '0931234567',