Fix wait_time_minutes NaN validation

This commit is contained in:
gpt-engineer-app[bot]
2025-10-02 17:49:28 +00:00
parent 2750d285cb
commit 7c7e243741

View File

@@ -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<typeof reviewSchema>;