From d8ba66f83b60d5671090925f749644842bf67949 Mon Sep 17 00:00:00 2001 From: Joshua Zhou Date: Mon, 10 Nov 2025 18:58:40 -0500 Subject: [PATCH 1/2] Add validation for empty phone numbers --- src/features/Account/validationSchema.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/features/Account/validationSchema.ts b/src/features/Account/validationSchema.ts index 2d711c5e..52138178 100644 --- a/src/features/Account/validationSchema.ts +++ b/src/features/Account/validationSchema.ts @@ -22,6 +22,7 @@ const getValidationSchema = (isCreate: boolean) => { 'validPhone', 'Must be a valid phone number', (value) => { + if (!value) return false; const parsedValue = value?.replace(/\D/g, ''); return ( !parsedValue || (parsedValue.length > 10 && parsedValue.length < 14) From 696599e39900d802b898e4c7d8c3746f1408b59e Mon Sep 17 00:00:00 2001 From: Joshua Zhou Date: Mon, 10 Nov 2025 19:03:57 -0500 Subject: [PATCH 2/2] check for empty parsed --- src/features/Account/validationSchema.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/features/Account/validationSchema.ts b/src/features/Account/validationSchema.ts index 52138178..c531ea1b 100644 --- a/src/features/Account/validationSchema.ts +++ b/src/features/Account/validationSchema.ts @@ -24,9 +24,8 @@ const getValidationSchema = (isCreate: boolean) => { (value) => { if (!value) return false; const parsedValue = value?.replace(/\D/g, ''); - return ( - !parsedValue || (parsedValue.length > 10 && parsedValue.length < 14) - ); + if (!parsedValue) return false; + return parsedValue.length > 10 && parsedValue.length < 14; } ), age: number()