Files
silverbullet-icalendar/conductor/tracks/fix_rrule_object_mapping_20260219/spec.md

1.6 KiB

Specification: Fix RRULE Object Expansion Error

Overview

The previous fix for handling object-type rrule properties (returned by ts-ics) introduced a regression. The conversion logic used uppercase full names (e.g., FREQUENCY), but the rrule library's parseString method expects standard iCalendar shortened keys (e.g., FREQ). This results in an Error: Unknown RRULE property 'FREQUENCY'.

Functional Requirements

  • Correct Key Mapping: The logic that converts an rrule object back to a string must use standard iCalendar RRULE property keys.
  • Mapping Table:
    • frequency -> FREQ
    • until -> UNTIL
    • count -> COUNT
    • interval -> INTERVAL
    • bysecond -> BYSECOND
    • byminute -> BYMINUTE
    • byhour -> BYHOUR
    • byday -> BYDAY
    • bymonthday -> BYMONTHDAY
    • byyearday -> BYYEARDAY
    • byweekno -> BYWEEKNO
    • bymonth -> BYMONTH
    • bysetpos -> BYSETPOS
    • wkst -> WKST
  • Case Insensitivity: The mapping should be case-insensitive for the input object keys.

Implementation Steps

  1. Reproduce: Update the existing expandRecurrences - object rrule test case to use the key frequency and verify it fails with the reported error.
  2. Fix: Implement a mapping function in icalendar.ts to translate object keys to standard RRULE keys before stringifying.
  3. Verify: Run the test case to confirm it now passes.

Acceptance Criteria

  • Test expandRecurrences - object rrule passes with an object using frequency key.
  • No "Unknown RRULE property" errors are logged for valid RRULE objects.