Skip to content

Commit

Permalink
fix: Incorrect Phone Error Displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Jan 9, 2025
1 parent 5fb81d6 commit db79f70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/PhoneNumberTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit db79f70

Please sign in to comment.