RfcDateRule

RfcDateRule :: # (opaque)

RFC 5545 DATE recurrence value adapter, profile date-values-v1. Input fields are already extracted property values, not content lines or an ICS document. DTSTART/RDATE/EXDATE/UNTIL use YYYYMMDD, years 0001–9999. DAILY/WEEKLY/MONTHLY/YEARLY, date selectors, WKST, COUNT and UNTIL are supported. Return the same DateRecurrence used by native constructors. Timed values, subdaily frequencies, extensions and implicit YEARLY defaults described below are explicit unsupported scopes. No source spelling, serialization, full iCalendar, or full RFC conformance claim is made.

Example

Parse extracted property values, then use the ordinary recurrence cursor. These inputs are values, not complete DTSTART: lines or an ICS document. Timed values and unsupported extensions return explicit errors.

import time.RfcDateRule
import time.GregorianDate
import time.DateRecurrence

expect {
    rule = RfcDateRule.parse({
        start: "20250131",
        rule: "FREQ=MONTHLY;COUNT=3",
        inclusions: [],
        exclusions: ["20250331"],
    })?
    start = GregorianDate.from_fields({ year: 2025, month: 1, day: 1 })?
    end = GregorianDate.from_fields({ year: 2025, month: 6, day: 1 })?
    cursor = DateRecurrence.cursor(rule, { start, end })?
    batch = DateRecurrence.Cursor.collect(cursor, {
        max_steps: 1000, max_buffered: 31, max_occurrences: 4,
    })?
    batch.dates.map(|date| GregorianDate.to_fields(date).month) == [1.U8, 5]
}

Examples assume a package dependency named time.

parse : Parts -> Try(DateRecurrence, Error)

At most 65536 input bytes in total and 4096 supplied inclusion/exclusion strings each. RDATE/EXDATE entries may contain comma-separated dates; each expanded list and selector list is limited to 4096 values. Parse O(input bytes + supplied entries), then bounded DateRecurrence construction. Never expand a series here. Names/enumerations are ASCII case-insensitive; whitespace, folded lines, duplicate keys and numeric overflow are errors.

Error : [Malformed(Str), Duplicate(Str), Missing(Str), Unsupported(Str), OutOfRange(Str), Incompatible(Str), InvalidDate(Str), TooLarge, InvalidRule([InvalidInterval, TooManySelectors, InvalidSelector(Str), InvalidCombination(Str), InvalidCount, InvalidUntil, UnsynchronizedStart, OutOfRange])]