Last active
May 14, 2024 10:16
Revisions
-
mogarick renamed this gist
Feb 27, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ //Please note I'm also using underscore each function for the iterations //iCal -> jsCal var icalEvents = ICal.parse(iCalStringData); //jsCal->Component -
mogarick revised this gist
Feb 27, 2014 . 1 changed file with 35 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,43 @@ //iCal -> jsCal var icalEvents = ICal.parse(iCalStringData); //jsCal->Component var comp = new Component(icalEvents[1]); //Get all VTIMEZONE iCalendar components var vtimezones = comp.getAllSubcomponents("vtimezone"); //Add all timezones in iCalendar object to TimezonService //if they are not already registered. _.each(vtimezones, function (vtimezone) { if (!(ICAL.TimezoneService.has( vtimezone.getFirstPropertyValue("tzid")))) { ICAL.TimezoneService.register(vtimezone); } }); //Get all VEVENT iCalendar components var vevents = comp.getAllSubcomponents("vevent"); var events = []; var eventCount = 1; _.each(vevents, function (vevent) { var event = new Event(vevent); //Get the datetime info in UTC format with appropiate offset var startDate = new Date(event.startDate.toUnixTime() * 1000); var endDate = new Date(event.endDate.toUnixTime() * 1000); console.log(eventCount, " - - - - - - - - - - - - - - - - - - "); console.log("UID:", event.uid); console.log("Recurrent?", event.isRecurring()); console.log("Start:", startDate); console.log("End:", endDate); //This also depends on the correct timezone to be present in TimezoneService console.log("Duration:",event.duration.toString()); console.log("Lugar:", event.location); console.log("Organizer:", event.organizer); console.log("Atendees:", event.attendees); console.log("Summary:", event.summary); console.log("Description", event.description); console.log("\n"); events.push(event); eventCount++; }); -
mogarick created this gist
Feb 27, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ var vtimezones = comp.getAllSubcomponents("vtimezone"); _.each(vtimezones, function (vtimezone) { //Si timezone está registrada if (!(ICAL.TimezoneService.has( vtimezone.getFirstPropertyValue("tzid")))) { ICAL.TimezoneService.register(vtimezone); } });