calendaryjs-plugin-ics
New to calendaryjs? Start with the core README — this plugin serializes its output.
Turn generated calendar occurrences into a standard .ics VCALENDAR that Apple
Calendar, Google Calendar, Outlook and anything else can subscribe to. An edge
integration — calendaryjs owns the calendar core; this only serializes its plain
output, with zero runtime dependency.
Install
npm i calendaryjs calendaryjs-plugin-icsUse it
Generate occurrences with calendaryjs, then pass them to toICS():
import { calendary } from "calendaryjs";
import { every, date } from "calendaryjs/builder";
import { toICS } from "calendaryjs-plugin-ics";
const cal = calendary();
cal.addGroup({
id: "holidays",
events: [every("year").on(date(12, 25)).title("Christmas")],
});
const events = cal.getEventsInRange("2026-01-01", "2026-12-31");
const ics = toICS(events, { calendarName: "Holidays" });
// → a VCALENDAR string: write to a .ics file or serve it from an endpointOne VEVENT per occurrence (events come pre-expanded, so no RRULE) — lunar / hijri /
formula dates and per-occurrence exceptions & overrideDates all export correctly.
Reminders → VALARM, priority → PRIORITY, plus DESCRIPTION / LOCATION / URL /
CATEGORIES / COLOR.
Reference
toICS(events, options?) → string; // a full VCALENDAR document| Option | Notes |
|---|---|
prodId |
PRODID |
calendarName |
X-WR-CALNAME — the calendar's display name |
method |
METHOD, e.g. "PUBLISH" |
dtstamp |
fixed Date → byte-stable, diff-friendly output |
priorityMap |
override priority → ICS PRIORITY (return 0 to omit) |
Also exported: eventToVEvent(event, options?) — a single VEVENT block (no wrapper).
License
MIT. This plugin requires the calendaryjs core, which is licensed
PolyForm Noncommercial — so commercial use of the combined work requires a
commercial license for the core. See Commercial licensing.