fix: use event TZID for UNTIL date conversion

Add a `tz` field to `rem` to carry the event's DTSTART timezone, and
introduce `timedesc_of_utc_or_timestamp_tz` to convert UNTIL timestamps
in that timezone instead of the process locale. This makes UNTIL
comparisons locale-independent for events with a known TZID.
This commit is contained in:
2026-05-18 00:17:04 +02:00
parent eda3be195a
commit 2c4191ef13
3 changed files with 24 additions and 4 deletions

View File

@@ -112,6 +112,14 @@ let timedesc_of_utc_or_timestamp_local (ts : utc_or_timestamp_local) : Timedesc.
(* this case is not present in my current dataset… *)
| `Utc t -> t |> Timedesc.Utils.timestamp_of_ptime |> Timedesc.of_timestamp_exn ~tz_of_date_time:local_tz
(** Convert a UTC-or-local timestamp to a Timedesc.t in the given timezone. Use this (instead of
[timedesc_of_utc_or_timestamp_local]) when the event has a known TZID, so that UNTIL comparisons are independent of
the process locale. *)
let timedesc_of_utc_or_timestamp_tz (tz : Timedesc.Time_zone.t) (ts : utc_or_timestamp_local) : Timedesc.t =
match ts with
| `Local t -> t |> Timedesc.Utils.timestamp_of_ptime |> Timedesc.of_timestamp_exn ~tz_of_date_time:tz
| `Utc t -> t |> Timedesc.Utils.timestamp_of_ptime |> Timedesc.of_timestamp_exn ~tz_of_date_time:tz
let get_exdates ev =
let event_props = ev.props in
let dates_or_datetimes =