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:
@@ -82,7 +82,7 @@ open Utils
|
||||
snippet: 'REM Jul 29 MSG Compleanno'
|
||||
priorita: Dopo
|
||||
|
||||
- id: P10
|
||||
- id: P10 ✅
|
||||
pattern: Eccezioni
|
||||
ics: "EXDATE (una o più), RDATE aggiuntive"
|
||||
remind_support: nativo+accorgimenti
|
||||
@@ -192,9 +192,13 @@ let collect_start_end_duration rem ev : (Remind.rem, error) result =
|
||||
Ok { rem with Remind.date = day_start; Remind.end_date = None }
|
||||
else Ok { rem with Remind.date = day_start; Remind.end_date = Some day_end }
|
||||
end
|
||||
| Some (`Duration (_, _duration)) ->
|
||||
(* Start is a date, duration is not supported: invalid case for all-day event *)
|
||||
skip
|
||||
| Some (`Duration (_, duration)) ->
|
||||
(* DATE + DURATION: compute end_date as start + duration_in_days - 1 *)
|
||||
let days, _ = Ptime.Span.to_d_ps duration in
|
||||
if days <= 1 then Ok { rem with Remind.date = day_start; Remind.end_date = None }
|
||||
else
|
||||
let day_end = Timedesc.Date.add ~days:(days - 1) day_start in
|
||||
Ok { rem with Remind.date = day_start; Remind.end_date = Some day_end }
|
||||
end)
|
||||
| `Datetime datetime -> begin
|
||||
let start_td = Utils.timedesc_of_timestamp datetime in
|
||||
@@ -291,7 +295,7 @@ RRULE: (`Weekly, (Some `Until (`Utc (2026-07-01 09:00:00 +00:00))), None, [])
|
||||
| Some (_, (`Yearly, None, None, [])) -> Ok rem (* handled in yearly_simple_date *)
|
||||
| Some (_, ((`Weekly as freq), count_or_until, interval, recurs))
|
||||
| Some (_, ((`Daily as freq), count_or_until, interval, recurs)) ->
|
||||
begin if List.length rem.recurring > 0 || List.length rem.exdate > 0 then (
|
||||
begin if List.length rem.recurring > 0 then (
|
||||
Printf.eprintf "Warning: skipping complex recurrence with EXDATE/RDATE/overrides, not supported\t\t\tUID: %s\n"
|
||||
(Utils.get_uid ev);
|
||||
debug_print_of_recurrence_and_skip ev (freq, count_or_until, interval, recurs))
|
||||
@@ -311,6 +315,7 @@ RRULE: (`Weekly, (Some `Until (`Utc (2026-07-01 09:00:00 +00:00))), None, [])
|
||||
match freq with
|
||||
| `Daily -> Ok { rem with Remind.weekly = None; Remind.daily = Some { count_or_until; interval; week_start } }
|
||||
| `Weekly ->
|
||||
let days = if days = [] then [ timedesc_wd_to_ical (Timedesc.Date.weekday rem.date) ] else days in
|
||||
Ok
|
||||
{
|
||||
rem with
|
||||
|
||||
Reference in New Issue
Block a user