aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/datetime.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2020-01-30 22:51:45 +0100
committerHugo Hörnquist <hugo@hornquist.se>2020-01-30 22:51:45 +0100
commitf852c30bcef530d18a474ab6ab8350a3ef93d563 (patch)
tree00fc29a6ff1a8c842d0a526f04d4124977dd6e46 /module/vcomponent/datetime.scm
parentUpdate recurrence generate to new date obj. (diff)
downloadcalp-f852c30bcef530d18a474ab6ab8350a3ef93d563.tar.gz
calp-f852c30bcef530d18a474ab6ab8350a3ef93d563.tar.xz
Once again compiles.
Diffstat (limited to 'module/vcomponent/datetime.scm')
-rw-r--r--module/vcomponent/datetime.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/module/vcomponent/datetime.scm b/module/vcomponent/datetime.scm
index c01de7e7..765c065d 100644
--- a/module/vcomponent/datetime.scm
+++ b/module/vcomponent/datetime.scm
@@ -34,9 +34,9 @@ Event must have the DTSTART and DTEND attribute set."
(attr event-b 'DTSTART)
(attr event-b 'DTEND)))
-(define (event-contains? ev datetime)
+(define (event-contains? ev date/-time)
"Does event overlap the date that contains time."
- (let* ((start (get-date datetime))
+ (let* ((start (as-date date/-time))
(end (add-day start)))
(event-overlaps? ev start end)))
@@ -52,8 +52,14 @@ Event must have the DTSTART and DTEND attribute set."
;; Returns the length of the part of @var{e} which is within the day
;; starting at the time @var{start-of-day}.
-(define-public (event-length/day e start-of-day)
+;; currently the secund argument is a date, but should possibly be changed
+;; to a datetime to allow for more explicit TZ handling?
+(define-public (event-length/day e)
(time-
- (time-min (add-day start-of-day) (attr e 'DTEND))
- (time-max start-of-day (attr e 'DTSTART))))
+ (time-min #00:00:00 (as-time (attr e 'DTEND)))
+ (time-max #24:00:00 (as-time (attr e 'DTSTART)))))
+
+;; 22:00 - 03:00
+;; 2h för dag 1
+;; 3h för dag 2