aboutsummaryrefslogtreecommitdiff
path: root/src/Date.hs
blob: e3c16e5421fc98e4d2ce6dc6cfe2ae2fb9d216c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Date
  ( getCurrentDate
  ) where

import Data.Time.Clock
import Data.Time.Calendar
import Data.Time.LocalTime

import Model.Date

getCurrentDate :: IO Date
getCurrentDate = do
  now <- getCurrentTime
  timezone <- getCurrentTimeZone
  let zoneNow = utcToLocalTime timezone now
  let (y, m, _) = toGregorian $ localDay zoneNow
  return (Date m (fromIntegral y))