calendaring_jmap.convert.ical_to_jscal module#

iCalendar to JSCalendar conversion (RFC 5545 to RFC 8984).

Public API:

ical_to_jscal(ical_str, calendar_id=None) -> dict

The output dict is a raw JSCalendar CalendarEvent object suitable for passing directly to CalendarEvent/set.

calendaring_jmap.convert.ical_to_jscal.ical_to_jscal(ical_str, calendar_id=None)[source]#

Convert an iCalendar string to a JSCalendar CalendarEvent dict (RFC 8984).

Processes the first VEVENT found in the string. Any sibling VEVENTs with a RECURRENCE-ID are folded into the recurrenceOverrides map of the master event. EXDATE entries are also added to recurrenceOverrides.

Parameters:
  • ical_str (str) – A VCALENDAR string (or bare VEVENT; fixup() normalises it).

  • calendar_id (str | None) – If provided, sets calendarIds: {calendar_id: true} on the output. Required when the result will be used in CalendarEvent/set (the server needs to know which calendar).

Return type:

dict

Returns:

Raw JSCalendar dict suitable for passing directly to CalendarEvent/set.

Raises:

ValueError – If no VEVENT component is found; the master VEVENT is missing UID or DTSTART (both mandatory per RFC 5545, but not every producer enforces this); DTSTART/DTEND have mismatched value types, one DATE and one DATE-TIME (RFC 5545 Section 3.8.2.2 requires both to match, and DTEND to be later in time than DTSTART); or DTEND/DURATION resolves to before DTSTART (RFC 8984 Section 5.1.2 requires duration to be zero or positive).

Last updated on 2026-11-01.