diff --git a/src/Utils/Schedule/Week.hs b/src/Utils/Schedule/Week.hs index 92e60de7b..b1efe9011 100644 --- a/src/Utils/Schedule/Week.hs +++ b/src/Utils/Schedule/Week.hs @@ -22,7 +22,7 @@ import Utils.Schedule.Week.TimeSlot -- TODO: implement dayOffset weekSchedule :: UserId -> Maybe Integer -> Widget -weekSchedule uid _dayOffset = do +weekSchedule uid dayOffset = do now <- liftIO getCurrentTime tz <- liftIO getCurrentTimeZone ata <- getSessionActiveAuthTags @@ -161,10 +161,11 @@ weekSchedule uid _dayOffset = do -- TODO: Internationalize default week start (and/or make configurable) -- TODO: auto-hide saturday and sunday (if there are no events scheduled)? week :: [Day] - week = go $ utctDay now + week = go $ fromMaybe 0 dayOffset `addDays` utctDay now where go day - | Monday <- dayOfWeek day = [day .. toEnum (fromEnum day + 6)] + | dayOfWeek day == firstDay = [day .. toEnum (fromEnum day + 6)] | otherwise = go $ pred day + firstDay = toEnum $ fromEnum Monday + fromInteger (fromMaybe 0 dayOffset) $(widgetFile "widgets/schedule/week")