Skip to content
Prev Previous commit
Next Next commit
Fix #829: Don't miss date-only EXDATEs on the same date as periodStart
  • Loading branch information
minichma committed Jul 2, 2025
commit 40af80eb45403ab1f02e3fd6014d89d5fd4a69aa
9 changes: 8 additions & 1 deletion Ical.Net/Evaluation/RecurringEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ public override IEnumerable<Period> Evaluate(CalDateTime referenceDate, CalDateT
var rdateOccurrences = EvaluateRDate(referenceDate, periodStart);

var exRuleExclusions = EvaluateExRule(referenceDate, periodStart, options);
var exDateExclusions = EvaluateExDate(referenceDate, periodStart);

// EXDATEs could contain date-only entries while DTSTART is date-time. Probably this isn't supported
// by the RFC, but it seems to be used in the wild (see https://github.com/ical-org/ical.net/issues/829).
// So we must make sure to return all-day EXDATEs that could overlap with recurrences, even if the day starts
// before `periodStart`. We therefore start 2 days earlier (2 for safety regarding the TZ).
// DISCUSS: Should we support date-only EXDATEs being mixed with date-time DTSTARTs at all? What
// if one has a time zone and the other doesn't? Many details are unclear.
var exDateExclusions = EvaluateExDate(referenceDate, periodStart?.AddDays(-2));

var periods =
rruleOccurrences
Expand Down