jens-maus / node-ical

NodeJS class for parsing iCalendar/ICS files
Apache License 2.0
120 stars 51 forks source link

implementation for VALARM #298

Closed jonnytest1 closed 8 months ago

jonnytest1 commented 9 months ago

https://www.kanzaki.com/docs/ical/valarm.html

according to this spec (which is also supported by google with private calender export) alarms are added like this:

BEGIN:VEVENT SUMMARY:event summary ... BEGIN:VALARM ACTION:DISPLAY TRIGGER:-P0DT0H30M0S // 30 minutes prior DESCRIPTION:This is an event reminder END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-P3D // 3 days prior DESCRIPTION:This is an event reminder END:VALARM END:VEVENT

currently they are just parsed as uuids

ideally i think they should not only be parsed but also a utility method added to get the TRIGGER correctly parsed resulting in a Date object (similarly to rrule)

( there is also non-relative alarms in the form of trigger: P0DT9H0M0S meaning it would be on the day of the event at 9 o clock my solution for this part looked like this since i already made the relative implementation

const copy = new Date(start_or_rrule_date);
copy.setHours(0)
copy.setMinutes(0)
copy.setSeconds(0)

return  new Date(+copy + this.timeOffset)

)

titanism commented 9 months ago

PR would be awesome for this 🔥

jonnytest1 commented 9 months ago

https://github.com/jens-maus/node-ical/pull/299