Skip to content
/ ics Public
forked from adamgibbons/ics

iCalendar (ics) file generator for node.js

Notifications You must be signed in to change notification settings

lasc/ics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ICS File Generator

Generate iCalendar files.

npm version Code Climate

Installation

npm install ics

Usage

Require the module: require('ics').

ics.getEvent(options)

Returns an iCal-compliant text string.

ics.createEvent(options, filepath, cb)

Returns a callback with an iCal-compliant .ics file.

Options:

  • dtstart: (Date string) Event start time. Defaults to current time.
  • dtend: (Date string) Event end time. Defaults to one hour from dtstart.
  • description: (String) Description (details) of the event.
  • eventName: (String) Title of the event as it appears in calendar application
  • filename: (String) Name of the iCal file. Defaults to calendar-event.ics.
  • organizer: (Object)
    • name: (String)
    • email: (String)

Example:

var ical = require('ics');

var options = {
  eventName: 'Fingerpainting lessons',
  fileName: 'event.ics',
  dtstart: 'Sat Nov 02 2014 13:15:00 GMT-0700 (PDT)',
  email: {
    name: 'Isaac Asimov',
    email: '[email protected]'
  }
};

ical.createEvent(options, null, function(err, success) {
  if (err) {
    console.log(err);
  }

  console.log(success); // returns filepath
});

The above snippet creates a file named event.ics, saves it to the operating system's temporary directory, and returns the filepath.

The event.ics file should look something like this:

BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:20150701T170000Z
ORGANIZER;CN=John Doe:MAILTO:[email protected]
DTSTART:20150714T170000Z
DTEND:20150715T035959Z
SUMMARY:Fingerpainting lessons
END:VEVENT
END:VCALENDAR

TODO

References

RFC 5545: Internet Calendaring and Scheduling Core Object Specification (iCalendar)

Initial iCalendar Elements Registries

About

iCalendar (ics) file generator for node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 86.8%
  • Ruby 12.7%
  • HTML 0.5%