jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.

Home Page:https://jkbrzt.github.io/rrule

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

byweekday undefined has different behavior than empty array

SinBirb opened this issue · comments

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.

  • Verify that you've looked through existing issues for duplicates before
    creating a new one
  • Code sample reproducing the issue. Be sure to include all input values you
    are using such as the exact RRule string and dates.
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());
  • Expected output
    true
  • Actual output
    false
  • The version of rrule you are using
    2.7.1
  • Your operating system
    Arch Linux
  • Your local timezone (run $ date from the command line
    of the machine showing the bug)
    CEST