8000 GitHub - ni-c/icalevent: a node module for creating ical events
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ni-c/icalevent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iCalEvent

Create an iCalEvent instance by setting limited properties and event.toFile() to get an ics formatted string back.

Install

With npm:

npm install icalevent

Examples

var iCalEvent = require('icalevent');

var event = new iCalEvent({
	offset: new Date().getTimezoneOffset(),
	start: '2014-07-01T02:00:00-05:00',
	end: '2014-07-01T02:30:00-05:00',
	summary: 'Priestly Duties',
	description: 'Home flu visit.',
	location: 'Casa',
	url: 'http://google.com/search?q=nacho+libre',
	organizer: {
		name: 'Nacho Libre',
		email: 'luchador@monastery.org'
	}
});

Or:

var iCalEvent = require('icalevent');

var event = new iCalEvent();

event.set('offset', new Date().getTimezoneOffset());
event.set('start', '2014-07-01T02:00:00-05:00');
event.set('end', '2014-07-01T02:30:00-05:00');
event.set('summary', 'Priestly Duties');
event.set('description', 'Home flu visit.');
event.set('location', 'Casa');
event.set('url', 'http://google.com/search?q=nacho+libre');
event.set('organizer', {name: 'Nacho Libre', email: 'luchador@monastery.org'});

To ics string:

event.toFile();

Returns:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//iCalEvent.js v0.3//EN
BEGIN:VEVENT
UID:d8dbbc27-7f97-4d83-9fdf-bb45d382ffdc
DTSTAMP:20131208T033712
DTSTART;TZID=US/Central:20140701T010000
DTEND;TZID=US/Central:20140701T013000
SUMMARY:Priestly Duties.
DESCRIPTION:Home flu visit.
ORGANIZER;CN=Nacho Libre:mailto:luchador@monastery.org
LOCATION:Casa
URL;VALUE=URI:http://google.com/search?q=nacho+libre
END:VEVENT
END:VCALENDAR

API

Properties

Required

  • offset (Integer) The Date.getTimezoneOffset() of the timezone the event is set in. Important: the offset has to be set before start and end times
  • start (Date Object) The start date object of the event
  • end (Date Object) The end date object of the event

Optional

  • location (String) The event location of the event. For example, monastery
  • url (String) A url corresponding to the event
  • summary (String) A summary of the event
  • description (String) A description of the event
  • organizer (Object) The organizer object in the following format:
{
	name: 'Nacho Libre',
	email: 'luchador@monastery.org'
}

Methods

.set(property, value)

event.set('url', 'http://google.com/search?q=nacho+libre');

.get(property)

event.get('url');

Returns:

http://google.com/search?q=nacho+libre

.toFile()

event.toFile();

Returns:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//iCalEvent.js v0.3//EN
BEGIN:VEVENT
UID:d8dbbc27-7f97-4d83-9fdf-bb45d382ffdc
DTSTAMP:20131208T033712
DTSTART;TZID=US/Central:20140701T010000
DTEND;TZID=US/Central:20140701T013000
SUMMARY:Priestly Duties.
DESCRIPTION:Home flu visit.
ORGANIZER;CN=Nacho Libre:mailto:luchador@monastery.org
LOCATION:Casa
URL;VALUE=URI:http://google.com/search?q=nacho+libre
END:VEVENT
END:VCALENDAR

License

MIT

Todos

  • tests

About

a node module for creating ical events

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0