aboutsummaryrefslogtreecommitdiff
path: root/src/Date.hs
diff options
context:
space:
mode:
authorJoris2015-11-21 21:41:38 +0100
committerJoris2015-11-21 21:41:38 +0100
commit5375ad26dd78220185f1ffe05222250c06dc1a0c (patch)
tree30998d4fe19206e8c5c9e564db116d2022e5e313 /src/Date.hs
parent7acd7a42f7663aa79d18e24bdb9fe19bf15f8fae (diff)
downloadevents-5375ad26dd78220185f1ffe05222250c06dc1a0c.tar.gz
events-5375ad26dd78220185f1ffe05222250c06dc1a0c.tar.bz2
events-5375ad26dd78220185f1ffe05222250c06dc1a0c.zip
Get next week birthdays and send an empty mail for the moment
Diffstat (limited to 'src/Date.hs')
-rw-r--r--src/Date.hs51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/Date.hs b/src/Date.hs
deleted file mode 100644
index 63830d3..0000000
--- a/src/Date.hs
+++ /dev/null
@@ -1,51 +0,0 @@
-module Date
- ( Date(..)
- , getCurrentDate
- , sameDayAndMonth
- , isBeforeOrEqualDayAndMonth
- , isAfterOrEqualDayAndMonth
- , yearsGap
- ) where
-
-import Data.Time.Clock
-import Data.Time.Calendar
-import Data.Time.LocalTime
-
-data Date = Date
- { day :: Int
- , month :: Int
- , year :: Int
- } deriving (Eq, Show)
-
-getCurrentDate :: IO Date
-getCurrentDate = do
- now <- getCurrentTime
- timezone <- getCurrentTimeZone
- let zoneNow = utcToLocalTime timezone now
- let (y, m, d) = toGregorian $ localDay zoneNow
- return $ Date d m (fromIntegral y)
-
-sameDayAndMonth :: Date -> Date -> Bool
-sameDayAndMonth d1 d2 =
- ( day d1 == day d2
- && month d1 == month d2
- )
-
-isBeforeOrEqualDayAndMonth :: Date -> Date -> Bool
-isBeforeOrEqualDayAndMonth d1 d2 =
- ( month d1 < month d2
- || ( month d1 == month d2
- && day d1 <= day d2
- )
- )
-
-isAfterOrEqualDayAndMonth :: Date -> Date -> Bool
-isAfterOrEqualDayAndMonth d1 d2 =
- ( month d1 > month d2
- || ( month d1 == month d2
- && day d1 >= day d2
- )
- )
-
-yearsGap :: Date -> Date -> Int
-yearsGap d1 d2 = abs (year d2 - year d1)