From 1900d805bf3a2d2342773853457e2a2378ee18aa Mon Sep 17 00:00:00 2001 From: Parker Date: Wed, 27 Dec 2023 19:44:09 -0700 Subject: [PATCH] Fix phone validation --- app/utils/user-validation.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/utils/user-validation.ts b/app/utils/user-validation.ts index 8613802..8383c1e 100644 --- a/app/utils/user-validation.ts +++ b/app/utils/user-validation.ts @@ -27,5 +27,7 @@ export const emailSchema = z export const phoneSchema = z .string() - .regex(/\(?\d{3}\)?\s?-?\d{3}-?\d{4}/, { message: 'Phone number must be ten digits'}) - .transform(phone => phone.replaceAll(/\D/g, '')) \ No newline at end of file + .regex(/^\(?\d{3}\)?\s?-?\d{3}-?\d{4}$/, { + message: 'Phone number must be ten digits', + }) + .transform(phone => phone.replaceAll(/\D/g, ''))