aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Birthdate.hs
diff options
context:
space:
mode:
authorJoris2015-11-22 12:15:41 +0100
committerJoris2015-11-22 12:15:41 +0100
commit09d822d47218141bf655d40a6f6f0395cfae69f0 (patch)
tree586785adc2bdb3073506eba25b1560f2f9af9986 /src/Model/Birthdate.hs
parent75e3bb69a3fec4be8850833da5cd11bbabcd99b7 (diff)
downloadevents-09d822d47218141bf655d40a6f6f0395cfae69f0.tar.gz
events-09d822d47218141bf655d40a6f6f0395cfae69f0.tar.bz2
events-09d822d47218141bf655d40a6f6f0395cfae69f0.zip
Validate birthdates and show an error message if there are invalid ones
Diffstat (limited to 'src/Model/Birthdate.hs')
-rw-r--r--src/Model/Birthdate.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Model/Birthdate.hs b/src/Model/Birthdate.hs
index 32bd6a4..f871860 100644
--- a/src/Model/Birthdate.hs
+++ b/src/Model/Birthdate.hs
@@ -2,8 +2,10 @@
module Model.Birthdate
( Birthdate(..)
+ , renderBirthdate
, fullname
, age
+ , ageNextWeek
, filterBirthdayAt
, filterBirthdayBetween
) where
@@ -19,6 +21,15 @@ data Birthdate = Birthdate
, lastname :: Text
} deriving (Eq, Show)
+renderBirthdate :: Birthdate -> Text
+renderBirthdate birthdate =
+ T.concat
+ [ fullname birthdate
+ , " ("
+ , renderDate (date birthdate)
+ , ")"
+ ]
+
fullname :: Birthdate -> Text
fullname d = T.concat [firstname d, " ", lastname d]