Skip to main content
@super-calendar/core ships parseICalendar and toICalendar to convert between .ics text and the library’s CalendarEvent shape — so a calendar built with super-calendar can import feeds from, and export to, Google Calendar, Apple Calendar, Outlook, and anything else that speaks iCal.

Import

parseICalendar(text) returns an array of events you can pass straight to a <Calendar>:
Each event carries the standard fields it round-trips: uid, description, location, plus allDay (from VALUE=DATE) and a recurrence parsed from RRULE. Recurring events are returned as a single event with a rule — expand them for a date range with expandRecurringEvents:

Export

toICalendar(events) produces a complete VCALENDAR string. Timed events are written in UTC; set allDay: true for VALUE=DATE events; a recurrence becomes an RRULE.
Pass { prodId, now } to set the calendar’s PRODID and the DTSTAMP written on each event. A stable UID is derived from the event when you don’t supply one, so re-exports stay diff-friendly.

What’s covered

A pragmatic subset of RFC 5545, aimed at real-world event interchange:
  • VEVENT with SUMMARY, DESCRIPTION, LOCATION, UID, DTSTART, and either DTEND or DURATION (e.g. PT1H30M, P1D).
  • All-day events via VALUE=DATE (a missing end becomes a one-day span).
  • Dates in UTC (...Z), a named IANA zone (TZID=Europe/London, resolved to the correct instant), floating local, or date-only; line folding and text escaping per the spec.
  • RRULE round-tripped to a RecurrenceRule (FREQ, INTERVAL, COUNT, UNTIL, weekly BYDAY, and ordinal BYDAY like 3MO/-1FRnthWeekday), plus EXDATE exception days (recurrence.exdates, honoured by expandRecurringEvents).
Not (yet) handled: VTODO / VJOURNAL, VALARM, attendees, attachments, and embedded VTIMEZONE definitions (a TZID must be a valid IANA name for the runtime’s Intl). Contributions welcome.