datetime/recurrence_iterator_utils library

Expand a parsed RRULE into concrete occurrences — roadmap #592.

The companion to parseRrule (#591): given a RecurrenceRule and a start instant, lazily generate the dates it describes. The result is a lazy Iterable (a sync* generator), so an unbounded rule is safe — bound it with the rule's own count/until, the expandRecurrence limit, or a .take(n) on the result. A rule with none of those and no .take iterates forever, by design.

Scope matches the #591 parser subset: FREQ daily/weekly/monthly/yearly with INTERVAL, BYDAY, BYMONTHDAY (incl. negative from month-end), BYMONTH, and WKST. The start instant supplies the time-of-day and UTC-ness of every occurrence and acts as DTSTART (occurrences before it are skipped).

Functions

expandRecurrence(RecurrenceRule rule, DateTime start, {int? limit}) Iterable<DateTime>
Lazily yields the occurrences of rule at and after start, in ascending order. limit caps the number emitted (in addition to any count/until on the rule); the first limit reached wins.