Skip to content

Commit

Permalink
fix date select error
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Jun 1, 2024
1 parent 5781e55 commit da981a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/atoms/CalendarDayBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import DatePointButton from "../molecules/DatePointButton";
interface CalendarDayBoxProps {
date: string;
value: number;
func: (date: number) => void;
func: (date: string) => void;
selectedDate: string;
pointType?: "mint";
}
Expand All @@ -36,7 +36,7 @@ function CalendarDayBox({ date, value, func, selectedDate, pointType }: Calendar
<DatePointButton
date={dayjsToStr(dayjsDate)}
value={value}
func={() => func(dayjsDate.date())}
func={() => func(dayjsToStr(dayjsDate))}
isSelected={date === selectedDate}
pointType={pointType}
/>
Expand Down
2 changes: 1 addition & 1 deletion components/molecules/WeekSlideCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import CalendarDayBox from "../atoms/CalendarDayBox";
interface CalendarProps {
selectedDate: Dayjs;
voteCntArr: VoteCntProps[];
func: (date: number) => void;
func: (date: string) => void;
}

function WeekSlideCalendar({ voteCntArr, selectedDate, func }: CalendarProps) {
Expand Down
10 changes: 2 additions & 8 deletions pageTemplates/home/studyController/StudyController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,9 @@ function StudyController() {
setSelectedDate(date);
}, [date]);

const onClick = (date: number) => {
const newDate = handleChangeDate(selectedDateDayjs, "date", date);
if (selectedDate === newDate) {
return;
}

const onClick = (date: string) => {
setStudyDateStatus(undefined);

newSearchParams.set("date", newDate);
newSearchParams.set("date", date);
router.replace(`/home?${newSearchParams.toString()}`, { scroll: false });
};

Expand Down

0 comments on commit da981a1

Please sign in to comment.