🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ical.js

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ical.js

Javascript parser for ics (rfc5545) and vcard (rfc6350) data

2.2.0
latest
Source
npm
Version published
Weekly downloads
196K
-7.6%
Maintainers
1
Weekly downloads
 
Created

What is ical.js?

ical.js is a JavaScript library for parsing and manipulating iCalendar data. It allows you to create, parse, and manipulate iCalendar files, which are commonly used for calendar events and scheduling.

What are ical.js's main functionalities?

Parsing iCalendar Data

This feature allows you to parse iCalendar data from a string and extract information from it. In this example, we parse an iCalendar string and extract the summary of the first event.

const ICAL = require('ical.js');
const icalData = 'BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nSUMMARY:Test Event\nDTSTART:20230301T120000Z\nDTEND:20230301T130000Z\nEND:VEVENT\nEND:VCALENDAR';
const jcalData = ICAL.parse(icalData);
const comp = new ICAL.Component(jcalData);
const vevent = comp.getFirstSubcomponent('vevent');
const summary = vevent.getFirstPropertyValue('summary');
console.log(summary); // Output: Test Event

Creating iCalendar Data

This feature allows you to create iCalendar data programmatically. In this example, we create a new event with a summary, start time, and end time, and then convert it to an iCalendar string.

const ICAL = require('ical.js');
const event = new ICAL.Component(['vcalendar', [], [
  ['vevent', [], [
    ['summary', {}, 'text', 'New Event'],
    ['dtstart', {}, 'date-time', '20230301T120000Z'],
    ['dtend', {}, 'date-time', '20230301T130000Z']
  ]]
]]);
const icalString = event.toString();
console.log(icalString);

Manipulating iCalendar Data

This feature allows you to manipulate existing iCalendar data. In this example, we parse an iCalendar string, update the summary of the first event, and then convert it back to an iCalendar string.

const ICAL = require('ical.js');
const icalData = 'BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nSUMMARY:Test Event\nDTSTART:20230301T120000Z\nDTEND:20230301T130000Z\nEND:VEVENT\nEND:VCALENDAR';
const jcalData = ICAL.parse(icalData);
const comp = new ICAL.Component(jcalData);
const vevent = comp.getFirstSubcomponent('vevent');
vevent.updatePropertyWithValue('summary', 'Updated Event');
const updatedIcalString = comp.toString();
console.log(updatedIcalString);

Other packages similar to ical.js

Keywords

calendar

FAQs

Package last updated on 28 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts