diff --git a/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx b/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx index 1f2b80aa5f4e..15704221f259 100644 --- a/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx +++ b/src/pages/settings/Profile/PersonalDetails/PhoneNumberPage.tsx @@ -56,7 +56,7 @@ function PhoneNumberPage() { errors[INPUT_IDS.PHONE_NUMBER] = translate('common.error.fieldRequired'); } const phoneNumberWithCountryCode = LoginUtils.appendCountryCode(values[INPUT_IDS.PHONE_NUMBER]); - const parsedPhoneNumber = PhoneNumberUtils.parsePhoneNumber(phoneNumberWithCountryCode); + const parsedPhoneNumber = PhoneNumberUtils.parsePhoneNumber(values[INPUT_IDS.PHONE_NUMBER]); if (!parsedPhoneNumber.possible || !Str.isValidE164Phone(phoneNumberWithCountryCode.slice(0))) { errors[INPUT_IDS.PHONE_NUMBER] = translate('bankAccount.error.phoneNumber'); } diff --git a/tests/unit/PhoneNumberTest.ts b/tests/unit/PhoneNumberTest.ts index f720dc6a88e1..562f7343f812 100644 --- a/tests/unit/PhoneNumberTest.ts +++ b/tests/unit/PhoneNumberTest.ts @@ -31,7 +31,7 @@ describe('PhoneNumber', () => { }); }); it('Should return invalid phone number', () => { - const invalidNumbers = ['+165025300001', 'John Doe', '123', 'email@domain.com']; + const invalidNumbers = ['+165025300001', 'John Doe', '123', '0945789083', 'email@domain.com']; invalidNumbers.forEach((givenPhone) => { const parsedPhone = parsePhoneNumber(givenPhone);