You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{DateTime}from"luxon";import{RRule}from"rrule";constrrule=RRule.fromString(event.recurrence[0]);// RRULE:FREQ=DAILYif(!event.start?.dateTime)returnnull;conststartDateTime=DateTime.fromISO(event.start.dateTime);console.log(startDateTime.toJSDate());rrule.options.dtstart=startDateTime.toJSDate();// 2024-05-01T11:30:00.000Zrrule.options.tzid=event.start?.timeZone??"America/New_York";conststartTime=startDateTime.toJSDate();rrule.options.bysecond=[startTime.getSeconds()];// Never mentioned in the docs, works for some reasonrrule.options.byminute=[startTime.getMinutes()];// If not set defaults to current time (wrong)rrule.options.byhour=[startTime.getHours()];constdates=rrule.all((d,i)=>{returni<1;}).map((d)=>{// Removes daylight savings timeconstlocalOffset=d.getTimezoneOffset();returnnewDate(d.getTime()+localOffset*60000);});console.log(dates);// [ 2024-05-02T04:30:00.000Z ]
The function (all()) does not return the first correct date, which is the dtstart. Furthermore if the same exact inputs are used to construct an RRule object with the options set, it does return the correct datetime.
fromString() behaves differently
[ 2024-05-02T04:30:00.000Z ]
[ 2024-05-01T04:30:00.000Z ]
2.8.1
Windows 11
America/Vancouver
The function (all()) does not return the first correct date, which is the dtstart. Furthermore if the same exact inputs are used to construct an RRule object with the options set, it does return the correct datetime.
Also now there is no need to set the bysecond, byminute, and byhour values
I am trying to integrate my program with google calendar events, and if I am doing something wrong please tell me.
Thanks.
The text was updated successfully, but these errors were encountered: