aboutsummaryrefslogtreecommitdiff
path: root/module/vcalendar/datetime.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-04-23 17:08:05 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-04-23 17:08:05 +0200
commit073b4584616c24be515f5b092ba1d095d6b168ec (patch)
tree70526baef63d6f65a78e3d358c0fd378bf23d052 /module/vcalendar/datetime.scm
parentAdd tree datatype. (diff)
downloadcalp-073b4584616c24be515f5b092ba1d095d6b168ec.tar.gz
calp-073b4584616c24be515f5b092ba1d095d6b168ec.tar.xz
Add some utilitiy functions.
Diffstat (limited to '')
-rw-r--r--module/vcalendar/datetime.scm7
1 files changed, 7 insertions, 0 deletions
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))