diff --git a/src/components/calendar/WeekCalendar.tsx b/src/components/calendar/WeekCalendar.tsx index 074fc63..d0a71b5 100644 --- a/src/components/calendar/WeekCalendar.tsx +++ b/src/components/calendar/WeekCalendar.tsx @@ -37,7 +37,26 @@ import { isDstTransitionDay, findDstTransitionHour } from '@utils'; import CalendarFilters from './CalendarFilters'; import CalendarNavigation from './CalendarNavigation'; +const useCurrentTime = () => { + const [now, setNow] = React.useState(() => { + return new Date(); + }); + + React.useEffect(() => { + const interval = setInterval(() => { + setNow(new Date()); + }, 60_000); + + return () => { + clearInterval(interval); + }; + }, []); + + return now; +}; + const WeekCalendar = () => { + const now = useCurrentTime(); const changeCalendarRange = useCalendarRangeChange(); const dayNotes = useDayNotes(); const { isDesktop } = useScreenWidth(); @@ -278,6 +297,15 @@ const WeekCalendar = () => { DST repeat
)} + {isToday(day, state.timeZone) && + now.getHours() === hour && ( + + )} {groupOccurrences(day, hour).map( ([habitId, habitOccurrences]) => { if (!habitOccurrences) {