datetime/rrule_parse_utils library
RFC 5545 recurrence-rule (RRULE) parser — a practical subset, roadmap #591.
Parses the calendar RRULE string used by iCalendar / Google Calendar exports
(FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,WE,FR;COUNT=10) into an immutable
RecurrenceRule value object. Pair with expandRecurrence (roadmap #592) to
turn a rule into concrete occurrences.
Supported parts: FREQ (DAILY/WEEKLY/MONTHLY/YEARLY), INTERVAL, COUNT,
UNTIL, BYDAY (weekday codes, no ordinal prefixes), BYMONTHDAY,
BYMONTH, WKST. Any other part (e.g. BYSETPOS, BYHOUR) throws a
FormatException rather than being silently ignored — a dropped constraint
would make the expansion wrong without warning, so the subset boundary is
explicit at parse time.
Classes
- RecurrenceRule
-
An immutable, parsed RRULE. Construct directly or via parseRrule. Defaults
mirror RFC 5545:
interval1,weekStartMonday, allby*lists empty.
Enums
- RecurFrequency
- How often a recurrence repeats. The four calendar frequencies; sub-day frequencies (HOURLY/MINUTELY/SECONDLY) are outside this subset.
- RecurWeekday
-
A day of the week, carrying both its RRULE code and its
DateTime.weekdaynumber so the iterator can match without a second lookup table.
Functions
-
parseRrule(
String input) → RecurrenceRule -
Parses an RRULE string (with or without a leading
RRULE:) into a RecurrenceRule. Part order is irrelevant; a duplicate part takes its last value. Throws FormatException whenFREQis missing, a part is malformed, or a part outside the supported subset appears.