aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-04-22 01:57:59 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-04-22 01:57:59 +0200
commit768200176c062fb589e526d91ceebdaeaf713e55 (patch)
tree4846faecdb3110b073523a4ec21a03235d790c89
parentAdd some date generating procedures. (diff)
downloadcalp-768200176c062fb589e526d91ceebdaeaf713e55.tar.gz
calp-768200176c062fb589e526d91ceebdaeaf713e55.tar.xz
Fix DTEND of timezoned events.
-rw-r--r--module/vcalendar.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/module/vcalendar.scm b/module/vcalendar.scm
index 3ada4058..dbab308c 100644
--- a/module/vcalendar.scm
+++ b/module/vcalendar.scm
@@ -33,14 +33,20 @@
(make-tz-set tz)))
(for ev in (children cal 'VEVENT)
- (define date (parse-datetime (attr ev 'DTSTART)))
+ (define date (parse-datetime (attr ev 'DTSTART)))
+ (define end-date (parse-datetime (attr ev 'DTEND)))
- (mod! (attr ev "DTEND") string->time-utc)
- (set! (attr ev "DTSTART") (date->time-utc date))
+ (set! (attr ev "DTSTART") (date->time-utc date)
+ (attr ev "DTEND") (date->time-utc end-date))
(when (prop (attr* ev 'DTSTART) 'TZID)
(set! (zone-offset date) (get-tz-offset ev)
- (attr ev 'DTSTART) (date->time-utc date))))
+ (attr ev 'DTSTART) (date->time-utc date)
+
+ ;; The standard says that DTEND must have the same
+ ;; timezone as DTSTART. Here we trust that blindly.
+ (zone-offset end-date) (zone-offset date)
+ (attr ev 'DTEND) (date->time-utc end-date))))
;; Return
cal)