Skip to content

Commit

Permalink
fix: get current date from the client
Browse files Browse the repository at this point in the history
  • Loading branch information
nunom27 committed Sep 19, 2024
1 parent f7826af commit e946d38
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ export default function Schedule({ filters, shifts }: ISchedulesProps) {
setSelectedFilters(myFilters);
}, []);

const [currentDate, setCurrentDate] = useState(() => new Date());

return (
<Layout
isHome={false}
Expand All @@ -242,10 +244,10 @@ export default function Schedule({ filters, shifts }: ISchedulesProps) {
<Calendar
toolbar={false}
localizer={localizer}
getNow={() => new Date()}
getNow={() => currentDate}
selected={selectedShift}
onSelectEvent={(shift) => handleSelection(shift)}
defaultDate={new Date()}
defaultDate={currentDate}
defaultView={"work_week"}
views={["work_week"]}
min={minDate}
Expand Down

0 comments on commit e946d38

Please sign in to comment.