mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 16:11:12 -05:00
Fix founded_year empty string validation
This commit is contained in:
@@ -104,7 +104,10 @@ export const companyValidationSchema = z.object({
|
|||||||
// Support both founded_date (preferred) and founded_year (legacy)
|
// Support both founded_date (preferred) and founded_year (legacy)
|
||||||
founded_date: z.string().optional(),
|
founded_date: z.string().optional(),
|
||||||
founded_date_precision: z.enum(['day', 'month', 'year']).optional(),
|
founded_date_precision: z.enum(['day', 'month', 'year']).optional(),
|
||||||
founded_year: z.coerce.number().int().min(1800).max(currentYear).optional().nullable(),
|
founded_year: z.preprocess(
|
||||||
|
(val) => val === '' || val === null || val === undefined ? undefined : val,
|
||||||
|
z.coerce.number().int().min(1800).max(currentYear).optional()
|
||||||
|
).optional().nullable(),
|
||||||
headquarters_location: z.string().max(200, 'Location must be less than 200 characters').optional(),
|
headquarters_location: z.string().max(200, 'Location must be less than 200 characters').optional(),
|
||||||
website_url: z.string().optional().refine((val) => {
|
website_url: z.string().optional().refine((val) => {
|
||||||
if (!val || val === '') return true;
|
if (!val || val === '') return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user