Permalink
Browse files

Use local time zone instead of UTC for date logic

  • Loading branch information...
1 parent 6f07a34 commit 8b3e1c18beb54859eff83ba76b9f6e8716da2d33 @samstokes committed Sep 14, 2011
Showing with 4 additions and 3 deletions.
  1. +2 −1 Handler/Root.hs
  2. +2 −2 Model.hs
View
@@ -46,7 +46,8 @@ getTasksR = maybeAuth >>= getTasksR' where
getTasksR' (Just (userId, user)) = do
tasks <- runDB $ userTasks userId
let (done, pending) = partition (taskDone . snd) tasks
- let doneByDay = groupByEq (fromJust . taskDoneDay . snd) done
+ timeZone <- liftIO getCurrentTimeZone
+ let doneByDay = groupByEq (fromJust . taskDoneDay timeZone . snd) done
estimates <- mapM (runDB . taskEstimates . fst) tasks
let tasksEstimates = M.fromList $ zip (map fst tasks) estimates
((_, taskWidget), enctype) <- generateFormPost taskForm
View
@@ -65,8 +65,8 @@ reorderTask direction filters = do
taskDone :: Task -> Bool
taskDone = isJust . taskDoneAt
-taskDoneDay :: Task -> Maybe Day
-taskDoneDay = fmap utctDay . taskDoneAt
+taskDoneDay :: TimeZone -> Task -> Maybe Day
+taskDoneDay tz = fmap (localDay . utcToLocalTime tz) . taskDoneAt
instance ToHtml Day where
toHtml = toHtml . show

0 comments on commit 8b3e1c1

Please sign in to comment.