diff options
Diffstat (limited to '')
-rw-r--r-- | module/vcalendar.scm | 5 | ||||
-rw-r--r-- | module/vcalendar/datetime.scm | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/module/vcalendar.scm b/module/vcalendar.scm index dbab308c..6beb63f5 100644 --- a/module/vcalendar.scm +++ b/module/vcalendar.scm @@ -125,6 +125,11 @@ (eq? (as-symb k1) (as-symb k2))) +(define-public (event-length e) + (time-difference + (attr e 'DTEND) + (attr e 'DTSTART))) + (define* (make-vcomponent #:optional path) (if (not path) (%vcomponent-make) diff --git a/module/vcalendar/datetime.scm b/module/vcalendar/datetime.scm index b27ce2b0..d9813372 100644 --- a/module/vcalendar/datetime.scm +++ b/module/vcalendar/datetime.scm @@ -6,6 +6,7 @@ #:export (parse-datetime event-overlaps? + overlapping? event-in? ev-time<?) ) @@ -26,6 +27,12 @@ Event must have the DTSTART and DTEND attribute set." (attr event 'DTEND) begin end)) +(define (overlapping? event-a event-b) + (timespan-overlaps? (attr event-a 'DTSTART) + (attr event-a 'DTEND) + (attr event-b 'DTSTART) + (attr event-b 'DTEND))) + (define (event-in? ev time) "Does event overlap the date that contains time." (let* ((date (time-utc->date time)) |