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

ical-generator

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ical-generator

ical-generator is a small piece of code which generates ical calendar files

9.0.0
latest
Version published
Weekly downloads
136K
-16.57%
Maintainers
1
Weekly downloads
 
Created

What is ical-generator?

The ical-generator npm package is a powerful tool for creating iCalendar (.ics) files in Node.js. It allows developers to generate calendar events programmatically, which can be used for scheduling, reminders, and other time-based functionalities.

What are ical-generator's main functionalities?

Create a Calendar

This feature allows you to create a new calendar instance with a specified domain and name. The `toString` method converts the calendar object to an iCalendar string format.

const ical = require('ical-generator');
const calendar = ical({
  domain: 'example.com',
  name: 'My Calendar'
});
console.log(calendar.toString());

Add Events

This feature allows you to add events to the calendar. You can specify the start and end times, summary, description, and location of the event.

const ical = require('ical-generator');
const calendar = ical();
calendar.createEvent({
  start: new Date(),
  end: new Date(new Date().getTime() + 3600000),
  summary: 'Meeting',
  description: 'Discuss project updates',
  location: 'Office'
});
console.log(calendar.toString());

Set Timezone

This feature allows you to set the timezone for the calendar and its events. This is useful for ensuring that events are displayed at the correct local time.

const ical = require('ical-generator');
const calendar = ical({
  timezone: 'America/New_York'
});
calendar.createEvent({
  start: new Date(),
  end: new Date(new Date().getTime() + 3600000),
  summary: 'Meeting',
  timezone: 'America/New_York'
});
console.log(calendar.toString());

Generate .ics File

This feature allows you to generate an .ics file from the calendar object. The .ics file can be shared and imported into various calendar applications.

const ical = require('ical-generator');
const fs = require('fs');
const calendar = ical();
calendar.createEvent({
  start: new Date(),
  end: new Date(new Date().getTime() + 3600000),
  summary: 'Meeting'
});
fs.writeFileSync('calendar.ics', calendar.toString());

Other packages similar to ical-generator

FAQs

Package last updated on 12 May 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