feat: support EXDATE, DATE+DURATION, and weekly day inference
- Handle DATE+DURATION all-day events by computing end_date from duration - Add PUSH/POP-OMIT-CONTEXT and OMIT/SKIP support for EXDATE in daily/weekly rendering - Adjust UNTIL date when local time of UNTIL timestamp precedes event start time - Default weekly RRULE to event's own weekday when BYDAY list is empty - Remove EXDATE check from complex-recurrence guard (handled via OMIT now) - Add timedesc_wd_to_ical weekday conversion utility - Remove verbose EXDATE debug logging - Fix minor newline in file processing log message
This commit is contained in:
15
bin/utils.ml
15
bin/utils.ml
@@ -2,6 +2,16 @@ open Icalendar
|
||||
|
||||
type months = Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec
|
||||
|
||||
let timedesc_wd_to_ical (wd : Timedesc.weekday) : Icalendar.weekday =
|
||||
match wd with
|
||||
| `Mon -> `Monday
|
||||
| `Tue -> `Tuesday
|
||||
| `Wed -> `Wednesday
|
||||
| `Thu -> `Thursday
|
||||
| `Fri -> `Friday
|
||||
| `Sat -> `Saturday
|
||||
| `Sun -> `Sunday
|
||||
|
||||
let show_error (e : Timedesc.Date.Ymd.error) : string =
|
||||
match e with
|
||||
| `Does_not_exist -> "Date does not exist"
|
||||
@@ -103,7 +113,6 @@ let timedesc_of_utc_or_timestamp_local (ts : utc_or_timestamp_local) : Timedesc.
|
||||
| `Utc t -> t |> Timedesc.Utils.timestamp_of_ptime |> Timedesc.of_timestamp_exn ~tz_of_date_time:local_tz
|
||||
|
||||
let get_exdates ev =
|
||||
let uid = get_uid ev in
|
||||
let event_props = ev.props in
|
||||
let dates_or_datetimes =
|
||||
List.filter_map
|
||||
@@ -121,10 +130,6 @@ let get_exdates ev =
|
||||
| `Datetimes ts_list -> (acc_datetimes @ ts_list, acc_dates))
|
||||
in
|
||||
|
||||
if List.length dates > 0 then Printf.eprintf "Found EXDATE with dates: %d entries; UID: %s\n" (List.length dates) uid;
|
||||
if List.length datetimes > 0 then
|
||||
Printf.eprintf "Found EXDATE with datetimes: %d entries; UID: %s\n" (List.length datetimes) uid;
|
||||
|
||||
List.map (fun d -> `Date d) dates @ List.map (fun dt -> `Datetime dt) datetimes
|
||||
|
||||
let get_rdates ev =
|
||||
|
||||
Reference in New Issue
Block a user