You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
expandOccurrences can drop occurrences of MONTHLY rules with BYMONTH #31
For FREQ=MONTHLY rules with BYMONTH, ical.js yields a year's months out of order. expandOccurrences stops at the first candidate past until and reports complete: true, so an occurrence that ical.js would yield later in that same year is silently missing. Found while building PhilflowIO/dav-mcp#110, which currently works around it by expanding one year past its window for this rule shape only.
Fix
expandOccurrences must not stop on the first candidate past until when the iterator is not monotonic for the rule shape (MONTHLY+BYMONTH, and any other shape where ical.js is known to be non-monotonic): continue to the end of the current period (year) before stopping, or sort within the period.
Never report complete: true when an occurrence could still follow.
Test: MONTHLY;BYMONTH=… rule where an in-range occurrence comes after an out-of-range candidate in ical.js's order; property test against an independent expansion for MONTHLY/YEARLY with BY parts.
Widened by the review of dav-mcp#110: it is not only MONTHLY+BYMONTH. ical.js emits candidates in the ORDER OF THE BY LISTS, not ascending, e.g. DAILY;BYHOUR=17,9 (200 inversions over 400 candidates), HOURLY;INTERVAL=4;BYMINUTE=45,15. expandOccurrences breaks on the first candidate past until (dist/index.mjs:1456-1458), so an occurrence or a moved-in override behind it is dropped while the result says complete. Fix for any rule whose iteration isn't monotonic: continue to the end of the current period (or sort BY lists ascending before expanding — check that this preserves BYSETPOS semantics). Also observed (pre-existing ical.js behaviour, worth tracking): leap-day YEARLY shows on 1 March in other years; BYSETPOS ignored on YEARLY; BYWEEKNO wrong with WKST; MONTHLY+BYMONTH ignores INTERVAL.
Activity
PhilflowIO commentedon Oct 8, 2026
Widened by the review of dav-mcp#110: it is not only MONTHLY+BYMONTH. ical.js emits candidates in the ORDER OF THE BY LISTS, not ascending, e.g.
DAILY;BYHOUR=17,9(200 inversions over 400 candidates),HOURLY;INTERVAL=4;BYMINUTE=45,15.expandOccurrencesbreaks on the first candidate pastuntil(dist/index.mjs:1456-1458), so an occurrence or a moved-in override behind it is dropped while the result says complete. Fix for any rule whose iteration isn't monotonic: continue to the end of the current period (or sort BY lists ascending before expanding — check that this preserves BYSETPOS semantics). Also observed (pre-existing ical.js behaviour, worth tracking): leap-day YEARLY shows on 1 March in other years; BYSETPOS ignored on YEARLY; BYWEEKNO wrong with WKST; MONTHLY+BYMONTH ignores INTERVAL.test(recur): draw the same property sample on every engine
fix(recur): fail closed when ical.js ignores the start positions
test(recur): widen the property sample and compare BYSETPOS instants
build(dist): rebuild for the start-position check