Fix date parsing bug

This commit is contained in:
gpt-engineer-app[bot]
2025-11-02 19:18:19 +00:00
parent dae687292b
commit 4215c8ad52
4 changed files with 10 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ import { FlexibleDateInput, type DatePrecision } from '@/components/ui/flexible-
import { useAuth } from '@/hooks/useAuth';
import { toast } from 'sonner';
import { handleError } from '@/lib/errorHandler';
import { toDateOnly } from '@/lib/dateUtils';
import { toDateOnly, parseDateOnly } from '@/lib/dateUtils';
import type { UploadedImage } from '@/types/company';
// Zod output type (after transformation)
@@ -163,7 +163,7 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
{/* Additional Details */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<FlexibleDateInput
value={watch('founded_date') ? new Date(watch('founded_date')) : undefined}
value={watch('founded_date') ? parseDateOnly(watch('founded_date')) : undefined}
precision={(watch('founded_date_precision') as DatePrecision) || 'year'}
onChange={(date, precision) => {
setValue('founded_date', date ? toDateOnly(date) : undefined);