The `ical` (formerly `node-ical`) package, at version 0.8.0, is a JavaScript library designed for parsing iCalendar (ICS) files, primarily targeting Node.js environments. It adheres to RFC5545 and offers a tolerant and minimal API for extracting event data from ICS strings or local files. While providing straightforward parsing for basic calendar entries, the library explicitly notes that handling complex features like recurrence rules (RRULE), event recurrences, and exception dates (EXDATE) requires more in-depth developer implementation. This version, published 6 years ago, represents a stable but older state of the library. Newer, actively maintained forks like `node-ical` (by jens-maus) and `ical.js` (by kewisch) exist, offering more modern features like async APIs, robust recurrence expansion, and TypeScript support, indicating that `ical@0.8.0` is in a de facto maintenance state, superseded by these alternatives.
npm install icalVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to parse an iCalendar string using `ical.parseICS` and iterate through the resulting event data, logging key details like summary, location, and start time. It handles basic event types and provides a fallback for malformed date data.
Update `package.json` to depend on `ical` and change `require('node-ical')` to `require('ical')`.Refer to `example_rrule.js` (if available in the full package) or custom logic to correctly expand and filter recurring events based on `rrule`, `recurrences`, and `exdate` properties.
Ensure you use `const ical = require('ical');` for importing the library. If working in an ESM-only project, a wrapper or a newer alternative (like `node-ical` or `ical.js` which support ESM) may be required.Consider migrating to a more current iCalendar parsing library if advanced features, active development, or native ESM/TypeScript support are needed.
Ensure you are running in a Node.js environment. If parsing a string, use `ical.parseICS(icsString)`. Verify the `ical` object is correctly initialized: `const ical = require('ical');`Verify the file path provided to `ical.parseFile()` is correct and that the process has read permissions for the file.
Always add defensive checks for `null` or `undefined` values on date properties (`ev.start`, `ev.end`) before attempting to access their methods. For example: `if (ev.start instanceof Date) { ev.start.getDate(); }`No dependency data recorded yet.