ical.js is a JavaScript library designed for parsing and manipulating iCalendar (RFC 5545) and vCard (RFC 6350) data, along with their JSON counterparts jCal (RFC 7265) and jCard (RFC 7095). The library is currently at version 2.2.1 and maintains an active development cycle, regularly releasing updates that include bug fixes, performance improvements, and TypeScript type enhancements. Originally ported from libical with a focus on web compatibility, it provides a robust, dependency-free solution for handling calendar and contact data. A key differentiator is its dual distribution, offering both ES6 modules for modern environments and a transpiled ES5 CommonJS build for broader compatibility, particularly in older browser script tags. It also offers an optional, separate bundle for comprehensive IANA timezone definitions, acknowledging their size and update frequency.
npm install ical.jsVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing an iCalendar string, accessing the calendar component, and iterating through its event components to log event summaries, locations, start times, and handle recurring events.
For modern environments (Node.js or browser with build tools), use `import ICAL from 'ical.js';`. For direct browser `<script>` tags or older environments, include the `ical.es5.cjs` bundle (e.g., `https://unpkg.com/ical.js/dist/ical.es5.min.cjs`).
For timezone-aware operations, you must explicitly include the separate `ical.timezones.js` bundle. This can be done as an additional script or integrated into your build process to ensure comprehensive timezone data is available.
For modern browsers, use `<script type="module" src="https://unpkg.com/ical.js/dist/ical.min.js"></script>`. For broader compatibility or older environments, use the ES5 CommonJS build: `<script src="https://unpkg.com/ical.js/dist/ical.es5.min.cjs"></script>`.
Ensure you are using `import ICAL from 'ical.js';` in module-aware environments or include the `ical.es5.cjs` bundle for legacy browser script tags.
Include `ical.timezones.js` in your project for comprehensive IANA timezone support. If issues persist, verify that the iCalendar data itself contains VTIMEZONE components if specific timezones are expected.
Review the iCalendar/vCard string for syntax compliance. Tools like the `ical.js` online validator (`kewisch.github.io/ical.js/validator.html`) can help identify specific parsing issues and correct formatting errors.
No dependency data recorded yet.