aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/datetime.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/vcomponent/datetime.scm')
-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)))))