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

byweekday undefined has different behavior than empty array #598

Open SinBirb opened 10 months ago

SinBirb commented 10 months ago

If this is expected behavior, please document it. However, I would expect an empty array to be treated the same way as not giving the option or at least .count() being 0. But if byweekday == [], then all days are in the rrule, which is definitely not obvious.

const dtstart = new Date(Date.UTC(2023, 8, 15, 3, 0, 0));
const until = new Date(Date.UTC(2023, 8, 22, 3, 0, 0));
const rule1 = new RRule({
    freq: RRule.WEEKLY,
    dtstart,
    until,
    interval: 1,
    byweekday: []
});
const rule2 = new RRule({
    freq: RRule.WEEKLY,
    dtstart,
    until,
    interval: 1
});
console.log(rule2.count() == rule1.count());