Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ical-generator

Package Overview
Dependencies
Maintainers
1
Versions
274
Alerts
File Explorer

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

  • 8.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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

Keywords

FAQs

Package last updated on 16 Oct 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc