Refactor: Implement datetime standardization

This commit is contained in:
gpt-engineer-app[bot]
2025-10-13 17:32:58 +00:00
parent 29f4f3c2aa
commit 5feee9f4bc
7 changed files with 472 additions and 8 deletions

View File

@@ -20,6 +20,7 @@ import { submitManufacturerCreation, submitManufacturerUpdate } from '@/lib/enti
import { useAuth } from '@/hooks/useAuth';
import { toast } from 'sonner';
import { useNavigate } from 'react-router-dom';
import { toDateOnly } from '@/lib/dateUtils';
// Raw form input state (before Zod transformation)
interface ManufacturerFormInput {
@@ -187,7 +188,7 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
value={watch('founded_date') ? new Date(watch('founded_date')) : undefined}
precision={(watch('founded_date_precision') as DatePrecision) || 'year'}
onChange={(date, precision) => {
setValue('founded_date', date ? date.toISOString().split('T')[0] : undefined);
setValue('founded_date', date ? toDateOnly(date) : undefined);
setValue('founded_date_precision', precision);
}}
label="Founded Date"