From 7c7e24374139797382202c86b526c44d6837fc5b Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:49:28 +0000 Subject: [PATCH] Fix wait_time_minutes NaN validation --- src/components/reviews/ReviewForm.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/reviews/ReviewForm.tsx b/src/components/reviews/ReviewForm.tsx index 2f9ae68b..c89592e5 100644 --- a/src/components/reviews/ReviewForm.tsx +++ b/src/components/reviews/ReviewForm.tsx @@ -19,7 +19,14 @@ const reviewSchema = z.object({ title: z.string().optional(), content: z.string().min(10, 'Review must be at least 10 characters long'), visit_date: z.string().optional(), - wait_time_minutes: z.number().optional(), + wait_time_minutes: z.preprocess( + (val) => { + if (val === '' || val === null || val === undefined) return undefined; + const num = Number(val); + return isNaN(num) ? undefined : num; + }, + z.number().positive().optional() + ), photos: z.array(z.string()).optional() }); type ReviewFormData = z.infer;