expandRecurrence

Calendar
stable

Expands a single calendar event with an optional RRULE string into all occurrences that fall within a given date range. Supports a minimal RFC 5545 subset (FREQ=DAILY|WEEKLY|MONTHLY, INTERVAL, COUNT, UNTIL, BYDAY). Non-recurring events are returned as-is when they overlap the range.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

Only FREQ=DAILY|WEEKLY|MONTHLY, INTERVAL, COUNT, UNTIL, and BYDAY are supported. Other RFC 5545 directives (BYMONTHDAY, EXDATE, …) are silently ignored.

API

Parameters

Input parameters accepted by this util.

event
required
IEvent
The calendar event to expand. If it has an rrule string, occurrences are generated; otherwise it is returned as-is (filtered against the range).
range
required
{ start: Date, end: Date }
The visible date window. Only occurrences that overlap this range are included in the result.

API

Return value

The value returned by this util.

An array of event copies (one per occurrence) that fall within the range. Empty array when no occurrences match.

Usage

Examples

Ready-to-paste usage snippets.

Weekly recurrence over a month

typescript