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

RRule.all() is returning different results if parsed from string or directly evaulated #577

Open domicode opened 1 year ago

domicode commented 1 year ago

I am creating a recurring rule in my JavaScript, however the Rule.all() behaves differently if I pass the generated string or call the method directly. Code snippet:

const rule = new RRule({
    freq,
    dtstart: datetime(from.year(), from.month() + 1, from.date(), from.hour(), from.minute()),
    interval: this.recurringInterval,
    wkst: RRule.MO,
    count: 3,
    byweekday: this.weekdayOption
});
console.log(rule.toString());
console.log(rule.all());
console.log(RRule.fromString(rule.toString()).all());

Output rule string:

DTSTART:20230404T080000Z
RRULE:FREQ=WEEKLY;INTERVAL=1;WKST=MO;COUNT=3

Output rule.all()

0 : Tue Apr 04 2023 10:00:00 GMT+0200 (Central European Summer Time) {}
1 : Wed Apr 05 2023 10:00:00 GMT+0200 (Central European Summer Time) {}
2 : Thu Apr 06 2023 10:00:00 GMT+0200 (Central European Summer Time) {}

Output rule.all() after passing the string

0 : Tue Apr 04 2023 10:00:00 GMT+0200 (Central European Summer Time) {}
1 : Tue Apr 11 2023 10:00:00 GMT+0200 (Central European Summer Time) {}
2 : Tue Apr 18 2023 10:00:00 GMT+0200 (Central European Summer Time) {}
scottboyd-ai commented 8 months ago

May have something to do with this?

https://github.com/jkbrzt/rrule/issues/523