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.27k stars 507 forks source link

Seeing some strange behavior with .all() and .between() #563

Open replaysMike opened 1 year ago

replaysMike commented 1 year ago

Using the following RRULE:

// [RRULE:FREQ=DAILY;INTERVAL=2;WKST=MO]
const rule = new RRule({
  freq: RRule.DAILY,
  interval: 2
});

output from rule.all() is not every 2 days

rule.all();
// length: 16513
// [0] Fri Dec 09 2022 14:37:54 GMT-0800 (Pacific Standard Time)
// [1] Thu Mar 02 2023 14:44:06 GMT-0800 (Pacific Standard Time)
// [2] Wed Mar 22 2023 15:44:06 GMT-0700 (Pacific Daylight Time)
// [3] Sun Oct 08 2023 15:44:06 GMT-0700 (Pacific Daylight Time)
// ...

if I output using between I get one result:

run.between(new Date(2022, 11, 1), new Date(2022, 11, 31))
// length: 1
// [0] Fri Dec 09 2022 14:37:54 GMT-0800 (Pacific Standard Time)

version: 2.7.1 os: Windows 10 tz: GMT-8 Pacific Standard

am I doing something wrong here?

replaysMike commented 1 year ago

I've also noticed when trying to use the datetime() class mentioned on the help page, it doesn't seem to exist:

export 'datetime' (imported as 'datetime') was not found in 'rrule' (possible exports: Frequency, RRule, RRuleSet, Weekday, rrulestr)

using react 18.2.0.

replaysMike commented 1 year ago

ah I see, this is already a ticket in issue #549 it's a shame I was hoping to use this lib :)