Skip to content

Commit

Permalink
Added minimum phone number length
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Donahue committed Oct 18, 2021
1 parent 96f2300 commit aebe59f
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 @@ -426,6 +426,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 aebe59f

Please sign in to comment.