Skip to content

Commit

Permalink
fix: 드래그 시 지난 시간 선택하지 못하도록 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dooohun committed Apr 7, 2024
1 parent e594d77 commit ff36757
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/page/Reservation/view/Week/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ export default function Week({ currentDate, setCurrentDate }: WeekProps) {
setDragStart({ time, day });
};

const handleMouseEnter = ({ time }: TimeSlotSelection) => {
const handleMouseEnter = ({ time, day }: TimeSlotSelection) => {
if (dragging) {
const fixedDay = dragStart?.day;
if (!fixedDay) return;
if (new Date(`${selectedYear}-${day} ${time}`) < new Date()) {
openSnackBar({ type: 'error', message: '지난 시간은 선택할 수 없습니다.' });
return;
}
setDragEnd({ time, day: fixedDay });
}
};
Expand Down

0 comments on commit ff36757

Please sign in to comment.