diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Date.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Date.hs b/src/Date.hs index 07f0672..6660f24 100644 --- a/src/Date.hs +++ b/src/Date.hs @@ -10,9 +10,9 @@ import Data.Time.Calendar import Data.Time.LocalTime data Date = Date - { year :: Int + { day :: Int , month :: Int - , day :: Int + , year :: Int } deriving (Eq, Show) getCurrentDate :: IO Date @@ -21,10 +21,10 @@ getCurrentDate = do timezone <- getCurrentTimeZone let zoneNow = utcToLocalTime timezone now let (y, m, d) = toGregorian $ localDay zoneNow - return $ Date (fromIntegral y) m d + return $ Date d m (fromIntegral y) sameDayAndMonth :: Date -> Date -> Bool -sameDayAndMonth (Date _ m1 d1) (Date _ m2 d2) = m1 == m2 && d1 == d2 +sameDayAndMonth (Date d1 m1 _) (Date d2 m2 _) = m1 == m2 && d1 == d2 yearsGap :: Date -> Date -> Int -yearsGap (Date y1 _ _) (Date y2 _ _) = abs (y2 - y1) +yearsGap (Date _ _ y1) (Date _ _ y2) = abs (y2 - y1) |