jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
https://jkbrzt.github.io/rrule
Other
3.24k stars 506 forks source link

Using RRule.after and RRule.between with Hermes JS Engine #603

Open jakechao-zeal opened 8 months ago

jakechao-zeal commented 8 months ago

Reporting an issue

The version of rrule you are using -- 2.7.2 Your operating system -- Windows using Expo SDK 49 w/hermes enabled (react native); I've tried on Expo SDK 47 as well Your local timezone (run $ date from the command line of the machine showing the bug) -- Monday, October 30, 2023 4:10:52 PM

Has anyone been able to use rrule successfully with Hermes as the JS engine? I am unable to use rrule.between at all (my program hangs) and when using rrule.after, I always get an invalid NaN date.

Code sample

cosnt rrule = "DTSTART;TZID=America/Los_Angeles:20231101T160000
RRULE:FREQ=WEEKLY;BYDAY=WE"
 const rule = rrulestr(rrule);

 const start = new Date("2023-10-30");
 const end = new Date(start);
 end.setDate(start.getDate() + 14)

 const afterDate = rule.after(new Date(startDate));
const between = rule.between(new Date(start, end);

Expected output:

11/1 and 11/8 instances of the recurring series

Actual output:

Either an invalid date when using rrule.after or program hangs for rrule.between

I believe this is due to the stricter parsing of dates that Hermes uses as per https://github.com/jkbrzt/rrule/issues/579 but I'm wondering if there's any workarounds.

lucy2329 commented 8 months ago

I'm having the same issue!