Skip to content

Commit

Permalink
Merge pull request #5938 from Expensify/luke-min-phone-length-vba
Browse files Browse the repository at this point in the history
Added minimum phone number length
  • Loading branch information
Jag96 authored Oct 19, 2021
2 parents 88766ac + aebe59f commit 9dc6877
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ const CONST = {
DEFAULT: 'default',
},
PHONE_MAX_LENGTH: 15,
PHONE_MIN_LENGTH: 5,
REGEX: {
US_PHONE: /^\+1\d{10}$/,
DIGITS_AND_PLUS: /^\+?[0-9]*$/,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ValidationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function meetsAgeRequirements(date) {
* @returns {Boolean}
*/
function isValidPhoneWithSpecialChars(phoneNumber) {
return CONST.REGEX.PHONE_WITH_SPECIAL_CHARS.test(phoneNumber) && phoneNumber.length <= CONST.PHONE_MAX_LENGTH;
return CONST.REGEX.PHONE_WITH_SPECIAL_CHARS.test(phoneNumber) && phoneNumber.length <= CONST.PHONE_MAX_LENGTH && phoneNumber.length >= CONST.PHONE_MIN_LENGTH;
}

/**
Expand Down

0 comments on commit 9dc6877

Please sign in to comment.