summaryrefslogtreecommitdiff
path: root/assignment-7/DateExtensions.icl
diff options
context:
space:
mode:
authorCamil Staps2017-11-05 14:06:53 +0100
committerCamil Staps2017-11-05 14:06:53 +0100
commit54f7f4d9d5b35a810626f5e567db74579a8987e5 (patch)
tree05c89c5667ba68baa29fb2eb3ee5c3c899375961 /assignment-7/DateExtensions.icl
parentAdd showAppointments tryouts with SVG, nicer makeAppointment, proposeAppointm... (diff)
Finish appointments and other improvements
Diffstat (limited to 'assignment-7/DateExtensions.icl')
-rw-r--r--assignment-7/DateExtensions.icl6
1 files changed, 6 insertions, 0 deletions
diff --git a/assignment-7/DateExtensions.icl b/assignment-7/DateExtensions.icl
index fa9ebb0..eded992 100644
--- a/assignment-7/DateExtensions.icl
+++ b/assignment-7/DateExtensions.icl
@@ -30,6 +30,12 @@ where
timestampToGmDate :: (Timestamp -> Date)
timestampToGmDate = toDate o timestampToGmDateTime
+addTime :: Time DateTime -> DateTime
+addTime t dt = timestampToGmDateTime (Timestamp dt`)
+where
+ (Timestamp dtst) = utcDateTimeToTimestamp dt
+ dt` = dtst + 3600 * t.Time.hour + 60 * t.Time.min + t.Time.sec
+
nextHour :: DateTime -> DateTime
nextHour t = timestampToGmDateTime (Timestamp ts`)
where