summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Scheduled.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Utility/Scheduled.hs b/Utility/Scheduled.hs
index 5b667d285..e759ecef4 100644
--- a/Utility/Scheduled.hs
+++ b/Utility/Scheduled.hs
@@ -76,19 +76,19 @@ nextTime schedule lasttime = do
calcNextTime :: Schedule -> Maybe LocalTime -> LocalTime -> Maybe NextTime
calcNextTime (Schedule recurrance scheduledtime) lasttime currenttime
| scheduledtime == AnyTime = do
- start <- findfromtoday
+ start <- findfromtoday True
return $ NextTimeWindow
start
(LocalTime (localDay start) (TimeOfDay 23 59 0))
- | otherwise = NextTimeExactly <$> findfromtoday
+ | otherwise = NextTimeExactly <$> findfromtoday False
where
- findfromtoday =
+ findfromtoday anytime =
LocalTime <$> nextday <*> pure nexttime
where
nextday = findnextday recurrance afterday today
today = localDay currenttime
afterday = sameaslastday || toolatetoday
- toolatetoday = localTimeOfDay currenttime >= nexttime
+ toolatetoday = not anytime && localTimeOfDay currenttime >= nexttime
sameaslastday = (localDay <$> lasttime) == Just today
nexttime = case scheduledtime of
AnyTime -> TimeOfDay 0 0 0