aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/parse.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2020-02-18 01:16:30 +0100
committerHugo Hörnquist <hugo@hornquist.se>2020-02-18 01:16:30 +0100
commit8c82f44c534abc57ce33d9c972d73ae9d7281709 (patch)
treec9c4127a5479163546fb937449dda8a72b9e9796 /module/vcomponent/parse.scm
parentAdd some TODO's. (diff)
downloadcalp-8c82f44c534abc57ce33d9c972d73ae9d7281709.tar.gz
calp-8c82f44c534abc57ce33d9c972d73ae9d7281709.tar.xz
Store TZ in sensible way when parsing datetimes.
Diffstat (limited to 'module/vcomponent/parse.scm')
-rw-r--r--module/vcomponent/parse.scm23
1 files changed, 11 insertions, 12 deletions
diff --git a/module/vcomponent/parse.scm b/module/vcomponent/parse.scm
index 24becd13..979eea7b 100644
--- a/module/vcomponent/parse.scm
+++ b/module/vcomponent/parse.scm
@@ -163,18 +163,17 @@
(case (get-line-key ctx)
[(DTSTART DTEND RECURRENCE-ID)
- (let ((v (prop it 'VALUE)))
- (mod! (value it)
- (if (or (and=>> v car (cut string=? <> "DATE-TIME"))
- (string-contains (value it) "T"))
- (begin
- (set! (prop it 'VALUE) "DATE-TIME")
- parse-datetime)
- (begin
- (set! (prop it 'VALUE) "DATE")
- parse-date))))]
-
- )
+ ;; '("Africa/Ceuta" "Europe/Stockholm" "local")
+ (let ((tz (or (and=> (prop it 'TZID) car)
+ (and (string= "Z" (string-take-right (value it) 1)) "UTC"))))
+
+ (let ((type (and=> (prop it 'VALUE) car)))
+ (if (or (and=> type (cut string=? <> "DATE-TIME"))
+ (string-contains (value it) "T"))
+ (set! (value it) (parse-datetime (value it) tz)
+ (prop it 'VALUE) 'DATE-TIME)
+ (set! (value it) (parse-date (value it))
+ (prop it 'VALUE) 'DATE))))])
;; From RFC 5545 §3.6.1