aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-03-24 23:02:24 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2020-03-24 23:02:24 +0100
commit6546132ed7b3fdc556912eab7fbc709875cb0b73 (patch)
treec960b3bc91415814ea744579addd3b0338ef5682 /module/vcomponent
parentAdd comment about DST and create-top-block. (diff)
downloadcalp-6546132ed7b3fdc556912eab7fbc709875cb0b73.tar.gz
calp-6546132ed7b3fdc556912eab7fbc709875cb0b73.tar.xz
Move some datetime procedures to propper modules.
Diffstat (limited to 'module/vcomponent')
-rw-r--r--module/vcomponent/datetime.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/module/vcomponent/datetime.scm b/module/vcomponent/datetime.scm
index 5df4dfab..b3940644 100644
--- a/module/vcomponent/datetime.scm
+++ b/module/vcomponent/datetime.scm
@@ -93,3 +93,13 @@ Event must have the DTSTART and DTEND attribute set."
;; 22:00 - 03:00
;; 2h för dag 1
;; 3h för dag 2
+
+;; An event is considered long if it's DTSTART (and thereby DTEND) lacks a time component,
+;; or if the total length of the event is greater than 24h.
+;; For practical purposes, an event being long means that it shouldn't be rendered as a part
+;; of a regular day.
+(define-public (long-event? ev)
+ (or (date? (attr ev 'DTSTART))
+ (datetime<= (datetime date: (date day: 1))
+ (datetime-difference (attr ev 'DTEND)
+ (attr ev 'DTSTART)))))