Registry / serialization / ical
library13.2.5jsnpmunverified

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 ical
INSTALL
IMPORT
SIG · ICAL
I
ical
serializationjavascriptv13.2.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ical
const ical = require('ical');
import ical from 'ical';
Version 0.8.0 of 'ical' is a CommonJS module and does not support native ES Modules import syntax. Use `require`.
parseICS
const ical = require('ical'); const data = ical.parseICS(icsString);
The `parseICS` function is a method of the default `ical` export. There are no named exports at this version.
parseFile
const ical = require('ical'); const data = ical.parseFile(filePath);
The `parseFile` function is a synchronous method for reading ICS files from the local filesystem.

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.

const ical = require('ical'); const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // Example ICS content (in a real app, this would come from a file or network request) const icsContent = `BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp//NONSGML Events//EN BEGIN:VEVENT UID:event1@example.com DTSTAMP:20260419T213000Z DTSTART:20260515T100000Z DTEND:20260515T110000Z SUMMARY:Node.js Conference Keynote LOCATION:Main Auditorium END:VEVENT BEGIN:VEVENT UID:event2@example.com DTSTAMP:20260419T213000Z DTSTART:20260601T090000Z DTEND:20260601T170000Z SUMMARY:JavaScript Deep Dive Workshop LOCATION:Room 301 END:VEVENT END:VCALENDAR`; const data = ical.parseICS(icsContent); console.log('Upcoming Events:'); for (let k in data) { if (data.hasOwnProperty(k)) { const ev = data[k]; if (ev.type === 'VEVENT') { const startDate = ev.start; const endDate = ev.end; // Ensure start/end are valid Date objects before accessing methods if (startDate instanceof Date && endDate instanceof Date) { console.log(`- ${ev.summary || 'Untitled Event'} is in ${ev.location || 'Unknown location'} on the ${startDate.getDate()} of ${months[startDate.getMonth()]} at ${startDate.toLocaleTimeString('en-GB')}`); } else { console.log(`- ${ev.summary || 'Untitled Event'} has malformed date data.`); } } } }
Debug
Known issues
breakingThe package underwent a name change from `node-ical` to `ical.js` and is available on npm under `ical`. Older projects might need to update their `require` statements and `package.json` dependencies.
fix
Update `package.json` to depend on `ical` and change `require('node-ical')` to `require('ical')`.
affects: <=0.7.x
gotchaHandling recurrence rules (RRULE), specific recurrences, and exception dates (EXDATE) for calendar events is significantly more complex than simple event parsing and requires careful implementation. The library provides the raw data but leaves the expansion logic to the developer.
fix
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.
affects: >=0.8.0
gotchaVersion 0.8.0 is strictly a CommonJS module. Attempting to use ES Modules `import` syntax will result in errors.
fix
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.
affects: <1.0.0
deprecatedThe `ical` package (version 0.8.0) is effectively superseded by more actively maintained forks and related libraries, such as `node-ical` (by jens-maus) and `ical.js` (by kewisch), which offer modern features and better ongoing support, including async APIs and TypeScript definitions.
fix
Consider migrating to a more current iCalendar parsing library if advanced features, active development, or native ESM/TypeScript support are needed.
affects: 0.8.0
Errors
Common errors & fixes
TypeError: ical.parseFile is not a function
The `parseFile` function is not available in the browser environment, or the `ical` object was not correctly imported/required.
fix
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');`
Error: ENOENT: no such file or directory, open 'calendar.ics'
The `ical.parseFile()` function could not find the specified ICS file at the given path.
fix
Verify the file path provided to `ical.parseFile()` is correct and that the process has read permissions for the file.
TypeError: Cannot read properties of undefined (reading 'getDate')
An event object returned by `ical.parseICS` or `ical.parseFile` might have malformed or missing date properties, leading to attempts to call Date methods on `undefined`.
fix
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(); }`
Upgrade
Version history
13.2.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
ical — npm install ical · libregistry