Skip to content

Commit

Permalink
(#0) inputDatePicker 이후 모든 날짜 적용 endDate null return
Browse files Browse the repository at this point in the history
  • Loading branch information
JinJu committed Dec 28, 2023
1 parent 7e2e10e commit b451436
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/core/components/Calendar/DatePickerCalendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/Input/InputDatePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement>) => e.target.blur()}
onChange = {() => {}}
Expand Down

0 comments on commit b451436

Please sign in to comment.