From aebe59f21a3031b3f658fa6782fb2514afa5880b Mon Sep 17 00:00:00 2001 From: Luke Donahue Date: Mon, 18 Oct 2021 16:16:43 -0700 Subject: [PATCH] Added minimum phone number length --- src/CONST.js | 1 + src/libs/ValidationUtils.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CONST.js b/src/CONST.js index 4828d3c4b594..c0dc14a23ecf 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -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]*$/, diff --git a/src/libs/ValidationUtils.js b/src/libs/ValidationUtils.js index 4b1223e25b78..bd821d5370ee 100644 --- a/src/libs/ValidationUtils.js +++ b/src/libs/ValidationUtils.js @@ -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; } /**