From 09d822d47218141bf655d40a6f6f0395cfae69f0 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 22 Nov 2015 12:15:41 +0100 Subject: Validate birthdates and show an error message if there are invalid ones --- src/Model/Birthdate.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Model/Birthdate.hs') 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] -- cgit v1.2.3