From 1be7ad3aee9b6b6544cde77fc26d90e18786e3b7 Mon Sep 17 00:00:00 2001 From: Renaldo Mateus Date: Tue, 31 Dec 2024 00:31:48 +0000 Subject: [PATCH] chore: make ddd optional and update phone number format --- src/lib/isMobilePhone.js | 2 +- test/validators.test.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 393ee6fbd..0069108b6 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -136,7 +136,7 @@ const phones = { 'pl-PL': /^(\+?48)? ?([5-8]\d|45) ?\d{3} ?\d{2} ?\d{2}$/, 'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[1-9]{1}\d{3}\-?\d{4}))$/, 'pt-PT': /^(\+?351)?9[1236]\d{7}$/, - 'pt-AO': /^(\+244)\d{9}$/, + 'pt-AO': /^(\+?244)?9\d{8}$/, 'ro-MD': /^(\+?373|0)((6(0|1|2|6|7|8|9))|(7(6|7|8|9)))\d{6}$/, 'ro-RO': /^(\+?40|0)\s?7\d{2}(\/|\s|\.|-)?\d{3}(\s|\.|-)?\d{3}$/, 'ru-RU': /^(\+?7|8)?9\d{9}$/, diff --git a/test/validators.test.js b/test/validators.test.js index aa13906b0..450c5f239 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -10365,10 +10365,12 @@ describe('Validators', () => { locale: 'pt-AO', valid: [ '+244911123432', - '+244123091232', + '911123432', + '244911123432', ], invalid: [ '+2449111234321', + '+244811123432', '31234', '31234567', '512345',