aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2015-10-11 17:03:20 +0200
committerJoris2015-10-11 17:03:20 +0200
commit94da91e1db4a5c130aa50579473e6a0a6b7a7958 (patch)
treeb95735f583fce1a3170bd6719c52361521115c61
parent785a5d63e8b7896be0379fba422d0076577d1084 (diff)
Secure date functions
-rw-r--r--src/Date.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Date.hs b/src/Date.hs
index 6660f24..8ab9fd2 100644
--- a/src/Date.hs
+++ b/src/Date.hs
@@ -24,7 +24,10 @@ getCurrentDate = do
return $ Date d m (fromIntegral y)
sameDayAndMonth :: Date -> Date -> Bool
-sameDayAndMonth (Date d1 m1 _) (Date d2 m2 _) = m1 == m2 && d1 == d2
+sameDayAndMonth d1 d2 =
+ ( day d1 == day d2
+ && month d1 == month d2
+ )
yearsGap :: Date -> Date -> Int
-yearsGap (Date _ _ y1) (Date _ _ y2) = abs (y2 - y1)
+yearsGap d1 d2 = abs (year d2 - year d1)