This package is mostly geared towards disseminating updates about events and synchronizing calendars for various clients. Feel free to fork and customize to your needs.
For a complete list of RFC-specified properties, see RFC 5545.
Include package
meteor add stuke:ics-generator
Instantiate and manipulate iCal components. Use setters or construct with prepopulated options. See source code for complete list of supported properties.
//generate entire object at once
var calOptions = {
prodId: "//Sugar Mills//Cereal Production",
method: "REQUEST",
events: [
{
uid: "[email protected]",
summary: "Favorite Cereal Discussion, Part 28",
dtStart: new Date(2015, 9, 1, 11),
dtEnd: new Date(2015, 9, 1, 12),
organizer: {cn: "Lucky Leprachaun", mailTo: "[email protected]"},
attendees: [
{cn: "Tony Tiger", mailTo: "[email protected]", partStat: "NEEDS-ACTION"}
]
}
]
};
var cal = new IcsGenerator(calOptions);
//generate event separately
var newEvent = cal.createEvent({
uid: "[email protected]",
summary: "Favorite Cereal Discussion, Part 29",
dtStart: new Date(2015, 9, 1, 16),
dtEnd: new Date(2015, 9, 1, 17),
organizer: {cn: "Lucky Leprachaun", mailTo: "[email protected]"}
});
//add invitees to event, or supply in constructor
newEvent.setProperty("attendees", [
{cn: "Tony Tiger", mailTo: "[email protected]", partStat: "NEEDS-ACTION"},
{cn: "Toucan Sam", mailTo: "[email protected]", partStat: "ACCEPTED"}
]);
//append event to calendar
cal.addEvent(newEvent);
//get output
var out = cal.toIcsString();
/*
BEGIN:VCALENDAR
PRODID://Sugar Mills//Cereal Production
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=L
ucky Leprachaun:MAILTO:[email protected]
DTSTART:20150901T180000Z
UID:[email protected]
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=To
ny Tiger:MAILTO:[email protected]
SUMMARY:"Favorite Cereal Discussion, Part 28"
DTEND:20150901T190000Z
DTSTAMP:20150815T232211Z
END:VEVENT
BEGIN:VEVENT
ORGANIZER;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=L
ucky Leprachaun:MAILTO:[email protected]
DTSTART:20150901T230000Z
UID:[email protected]
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=To
ny Tiger:MAILTO:[email protected]
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Toucan
Sam:MAILTO:[email protected]
SUMMARY:"Favorite Cereal Discussion, Part 29"
DTEND:20150902T000000Z
DTSTAMP:20150815T232211Z
END:VEVENT
END:VCALENDAR
*/
apache license applies.