RecurrenceRule
When something recurs (RFC 5545): its first occurrence as a local time in its zone, a line feed, then its rule: DTSTART;TZID=Europe/London:20261026T093000\nRRULE:FREQ=WEEKLY;BYDAY=MO. temporal.occurrences gives the next ones.
Time and calendar; not ordered; since Jadpo 0.1.0.
Make one
Build one from its text, RecurrenceRule("DTSTART;TZID=Europe/London:20261026T093000 RRULE:FREQ=WEEKLY;BYDAY=MO"), which checks it: text that isn't one breaks format.
text.parse(raw, as: RecurrenceRule) reads one from its text; text that isn't one at all fails malformed, such as FREQ=WEEKLY;BYDAY=MO or "".
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends its canonical text as a string.
| Text | JSON |
|---|---|
DTSTART;TZID=Europe/London:20261026T093000\nRRULE:FREQ=WEEKLY;BYDAY=MO |
"DTSTART;TZID=Europe/London:20261026T093000\nRRULE:FREQ=WEEKLY;BYDAY=MO" |
DTSTART;TZID=America/New_York:20260310T090000\nRRULE:FREQ=MONTHLY;BYDAY=2TU;COUNT=12 |
"DTSTART;TZID=America/New_York:20260310T090000\nRRULE:FREQ=MONTHLY;BYDAY=2TU;COUNT=12" |
DTSTART;TZID=Europe/London:20260130T170000\nRRULE:FREQ=MONTHLY;BYDAY=-1FR;UNTIL=20261231T235959Z |
"DTSTART;TZID=Europe/London:20260130T170000\nRRULE:FREQ=MONTHLY;BYDAY=-1FR;UNTIL=20261231T235959Z" |
DTSTART;VALUE=DATE:20240229\nRRULE:FREQ=YEARLY |
"DTSTART;VALUE=DATE:20240229\nRRULE:FREQ=YEARLY" |
It is stored in one column named for the field, of type text. DTSTART;TZID=Europe/London:20260130T170000\nRRULE:FREQ=MONTHLY;BYDAY=-1FR;UNTIL=20261231T235959Z is stored as E'DTSTART;TZID=Europe/London:20260130T170000\nRRULE:FREQ=MONTHLY;BYDAY=-1FR;UNTIL=20261231T235959Z'.
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
"DTSTART;TZID=Europe/London:20261026T093000\nRRULE:FREQ=WEEKLY;BYDAY=MO" |
"DTSTART;TZID=Europe/London:20261026T093000\nRRULE:FREQ=WEEKLY;BYDAY=MO" |
"DTSTART;TZID=America/New_York:20260310T090000\nRRULE:FREQ=MONTHLY;BYDAY=2TU;COUNT=12" |
"DTSTART;TZID=America/New_York:20260310T090000\nRRULE:FREQ=MONTHLY;BYDAY=2TU;COUNT=12" |
"DTSTART;TZID=Europe/London:20260130T170000\nRRULE:FREQ=MONTHLY;BYDAY=-1FR;UNTIL=20261231T235959Z" |
"DTSTART;TZID=Europe/London:20260130T170000\nRRULE:FREQ=MONTHLY;BYDAY=-1FR;UNTIL=20261231T235959Z" |
"DTSTART;VALUE=DATE:20240229\nRRULE:FREQ=YEARLY" |
"DTSTART;VALUE=DATE:20240229\nRRULE:FREQ=YEARLY" |
Operations
temporal.occurrences(rule: RecurrenceRule, from: T, count: Int) -> List<ZonedTime>: The nextcountoccurrences ofruleat or afterfrom, in its zone (RFC 5545): fewer when the rule ends first;countis from 1 to 1000, so an unbounded rule is never expanded without a bound. From a date, the days they fall on,List<CalendarDate>, which a rule on dates gives; from anInstant, a timed rule's local times.
Like every standard type, it also has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-recurrence-rule.md.Built from Jadpo main at e00e61f.