From dc4c1e93b14ed73e7ec2e5b5dcbb4c4bef7776b6 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 7 Apr 2025 17:53:12 +0900 Subject: [PATCH] =?UTF-8?q?datePicker=20value=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/date_picker/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/date_picker/index.tsx b/packages/common/business_components/src/ui/date_picker/index.tsx index 8fcd9b52e..d3a6a05c1 100644 --- a/packages/common/business_components/src/ui/date_picker/index.tsx +++ b/packages/common/business_components/src/ui/date_picker/index.tsx @@ -24,7 +24,6 @@ export function DatePicker({ field, selectClass }: DatePickerProps) { field.onChange(date); // React Hook Form 업데이트 setOpen(false); }; - return ( @@ -39,7 +38,12 @@ export function DatePicker({ field, selectClass }: DatePickerProps) { ):selectClass} > {field?.value ? ( - format(field?.value, "PPP", { locale: ko }) + format( + field.value instanceof Date && !isNaN(field.value.getTime()) + ? field.value + : new Date() + + , "PPP", { locale: ko }) ) : ( Pick a date )}