events: fix timezone-aware iCal export (local->UTC stamps) + 6 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 41s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 41s
Bug: tz events store wall-clock LOCAL times but export stamped them with a Z (UTC) suffix, so a London 18:00 event falsely read as 18:00 UTC. ev-ical-conv now converts a tz event's DTSTART/UNTIL/EXDATE/RDATE local->UTC before formatting (London summer 18:00 -> 170000Z; Paris -> 160000Z); non-tz events unchanged. Caveat: UTC RRULE drifts from wall-clock-stable tz recurrence across a DST boundary (VTIMEZONE deferred). 366/366 green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -266,6 +266,48 @@
|
||||
(ev-ic-starts (first events))
|
||||
(ev-ic-starts (ev-event (quote a) (ev-dt 2026 6 1 9 0) 30 {:freq :daily :count 3} 1)))))))))
|
||||
|
||||
;; ---- timezone-aware export (local wall-clock -> UTC stamps) ----
|
||||
(define
|
||||
ev-ic-dtstart
|
||||
(fn (ev) (ev-ic-line (ev/event->ical-lines ev) "DTSTART")))
|
||||
|
||||
(define
|
||||
ev-ic-tz-run-all!
|
||||
(fn
|
||||
()
|
||||
(do
|
||||
(ev-ic-check!
|
||||
"London winter event exports as the same UTC (GMT)"
|
||||
(ev-ic-dtstart (ev-event-tz (quote w) (ev-dt 2026 1 15 18 0) 60 nil 1 ev-tz-london))
|
||||
"DTSTART:20260115T180000Z")
|
||||
(ev-ic-check!
|
||||
"London summer event exports one hour earlier in UTC (BST)"
|
||||
(ev-ic-dtstart (ev-event-tz (quote s) (ev-dt 2026 7 15 18 0) 60 nil 1 ev-tz-london))
|
||||
"DTSTART:20260715T170000Z")
|
||||
(ev-ic-check!
|
||||
"Paris winter (CET +1) exports one hour earlier in UTC"
|
||||
(ev-ic-dtstart (ev-event-tz (quote p) (ev-dt 2026 1 15 18 0) 60 nil 1 ev-tz-paris))
|
||||
"DTSTART:20260115T170000Z")
|
||||
(ev-ic-check!
|
||||
"Paris summer (CEST +2) exports two hours earlier in UTC"
|
||||
(ev-ic-dtstart (ev-event-tz (quote p) (ev-dt 2026 7 15 18 0) 60 nil 1 ev-tz-paris))
|
||||
"DTSTART:20260715T160000Z")
|
||||
(ev-ic-check!
|
||||
"a non-tz event is exported unchanged"
|
||||
(ev-ic-dtstart (ev-event (quote n) (ev-dt 2026 7 15 18 0) 60 nil 1))
|
||||
"DTSTART:20260715T180000Z")
|
||||
;; EXDATE on a tz event is also converted to UTC
|
||||
(ev-ic-check!
|
||||
"tz event EXDATE is converted to UTC"
|
||||
(ev-ic-line
|
||||
(ev/event->ical-lines
|
||||
(assoc
|
||||
(ev-event-tz (quote s) (ev-dt 2026 7 1 18 0) 60 {:freq :daily :count 3} 1 ev-tz-london)
|
||||
:exdate
|
||||
(list (ev-dt 2026 7 2 18 0))))
|
||||
"EXDATE")
|
||||
"EXDATE:20260702T170000Z"))))
|
||||
|
||||
(define
|
||||
ev-ical-tests-run!
|
||||
(fn
|
||||
@@ -276,4 +318,5 @@
|
||||
(set! ev-ic-failures (list))
|
||||
(ev-ic-run-all!)
|
||||
(ev-ic-rt-run-all!)
|
||||
(ev-ic-tz-run-all!)
|
||||
{:failures ev-ic-failures :total (+ ev-ic-pass ev-ic-fail) :passed ev-ic-pass :failed ev-ic-fail})))
|
||||
|
||||
Reference in New Issue
Block a user