diff --git a/src/core/components/Calendar/DatePickerCalendar/index.tsx b/src/core/components/Calendar/DatePickerCalendar/index.tsx index e95ed97..f32662a 100644 --- a/src/core/components/Calendar/DatePickerCalendar/index.tsx +++ b/src/core/components/Calendar/DatePickerCalendar/index.tsx @@ -36,6 +36,9 @@ export const useDatePickerCalendar = (): UseDatePickerCalendarResponse => { if ((periodDates.startDate && periodDates.endDate) || afterAllDate) { newPeriodDates.startDate = currentDate; newPeriodDates.endDate = ""; + if (afterAllDate) { + newPeriodDates.endDate = null; + } return; } @@ -105,7 +108,7 @@ const DatePickerCalendar = ({ useEffect(() => { if (afterAllDate) { const newPeriodDates = models.periodDates; - newPeriodDates.endDate = ""; + newPeriodDates.endDate = null; operations.setPeriodDates({ ...newPeriodDates }); operations.setCalendarPeriodDates({ startDate: "", endDate: "" }); onDateClick(models.periodDates); diff --git a/src/core/components/Calendar/DatePickerCalendar/types/DatePickerCalendarProps.ts b/src/core/components/Calendar/DatePickerCalendar/types/DatePickerCalendarProps.ts index e8fd059..429beef 100644 --- a/src/core/components/Calendar/DatePickerCalendar/types/DatePickerCalendarProps.ts +++ b/src/core/components/Calendar/DatePickerCalendar/types/DatePickerCalendarProps.ts @@ -4,7 +4,7 @@ export type DatePickerType = typeof DATE_PICKER_TYPE[keyof typeof DATE_PICKER_TY export interface PeriodDates { startDate: string; - endDate: string; + endDate: string | null; } export interface DatePickerCalendarProps { diff --git a/src/core/components/Input/InputDatePicker/index.tsx b/src/core/components/Input/InputDatePicker/index.tsx index a367bb2..a0ff549 100644 --- a/src/core/components/Input/InputDatePicker/index.tsx +++ b/src/core/components/Input/InputDatePicker/index.tsx @@ -78,7 +78,7 @@ const InputDatePicker = ({ type = "text" placeholder = "날짜를 입력해주세요" className = {clsx("flex-1 focus-visible:outline-0 cursor-pointer pointer-events-none", inputClassName)} - value = {periodDates.startDate && `${startDate}${periodDates.endDate && ` - ${endDate}`}`} + value = {periodDates.startDate && `${startDate}${periodDates.endDate ? ` - ${endDate}` : ""}`} onKeyDown = {() => false} onFocus = {(e: React.FocusEvent) => e.target.blur()} onChange = {() => {}}