nwcell / ics.js

A browser firendly VCS file generator written entirely in javascript!!!!!!
MIT License
614 stars 258 forks source link

RRule Object #44

Open AbouJalal opened 6 years ago

AbouJalal commented 6 years ago

Hi,

It's a how-to question not an issue but don't know where to ask.

I have a content search webpart that using a display template to show the events. I followed the steps in this link: http://www.avtex.com/2016/04/generate-and-download-an-ical-event-in-sharepoint/. My webpart now is showing all items and i added a "Add to Calendar" button under each event. I even managed to know which "ctx.currentitem" is a recurring event. The problem now reside on how to expand this item to get all the information to construct the "RRule object" to be able to add to "cal.addEvent" function.

nwcell commented 6 years ago

It's an object that maps to the ics standards rrule string.

https://github.com/nwcell/ics.js/blob/master/ics.js#L61 https://github.com/nwcell/ics.js/blob/master/ics.js#L149

I'd dig into the ics specs if you wanted to learn more.

AbouJalal commented 6 years ago

Thanks for your help nwcell and for you fast respond!

Still don't get how to parse the data that i have into the rrule object. I have built an array: recData.push({'RecurrenceData' : data.d.RecurrenceData}, {'EventDate' : data.d.EventDate}, {'EndDate' : data.d.EndDate}, {'Duration' : data.d.Duration}, {'EventType' : data.d.EventType}); RecurrenceData has: "<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><monthly monthFrequency="1" day="26" /></repeat><repeatForever>FALSE</repeatForever></rule></recurrence>" EventDate has: 8/25/2017 6:00 PM EndDate has: 10/26/2100 5:59 PM Duration has: 86,340 EventType has: 1