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

DTSTART is not set for Exclusion rules in a RuleSet

gpitot opened this issue · comments

Reporting an issue

Thank you for taking an interest in rrule! Please include the following in
your report:
Version : "rrule": "^2.7.1",

const set = new RRuleSet();
set.rrule(
  new RRule({
    freq: RRule.DAILY,
    count: 10,
    dtstart: new Date(Date.UTC(2025, 2, 1, 10, 30)),
  })
);
set.exrule(
  new RRule({
    freq: RRule.DAILY,
    count: 2,
    dtstart: new Date(Date.UTC(2025, 2, 3, 10, 30)),
  })
);
console.log(set.all());
console.log(set.toString());
console.log(rrulestr(set.toString(), { forceset: true }).all());

Output of above:

[
      2025-03-01T10:30:00.000Z,
      2025-03-02T10:30:00.000Z,
      2025-03-05T10:30:00.000Z,
      2025-03-06T10:30:00.000Z,
      2025-03-07T10:30:00.000Z,
      2025-03-08T10:30:00.000Z,
      2025-03-09T10:30:00.000Z,
      2025-03-10T10:30:00.000Z
]

 DTSTART:20250301T103000Z
 RRULE:FREQ=DAILY;COUNT=10
 EXRULE:FREQ=DAILY;COUNT=2

[
      2025-03-03T10:30:00.000Z,
      2025-03-04T10:30:00.000Z,
      2025-03-05T10:30:00.000Z,
      2025-03-06T10:30:00.000Z,
      2025-03-07T10:30:00.000Z,
      2025-03-08T10:30:00.000Z,
      2025-03-09T10:30:00.000Z,
      2025-03-10T10:30:00.000Z
]

Expected output : dates in all() match up, which they do not. toString() should also have DTSTART for the EXRULE.

MAC OS, SYD/AU

also

const exRuleWithDTStart = `
      DTSTART:20250301T103000Z
      RRULE:FREQ=DAILY;COUNT=10
      DTSTART:20250303T103000Z
      EXRULE:FREQ=DAILY;COUNT=2`;

console.log(rrulestr(exRuleWithDTStart).all());

const exRuleWithoutDTStart = `
      DTSTART:20250301T103000Z
      RRULE:FREQ=DAILY;COUNT=10
      EXRULE:FREQ=DAILY;COUNT=2`;

console.log(rrulestr(exRuleWithoutDTStart).all());

Both equal the same values, so maybe I am doing something wrong?
How can I add a start time to the exclusion rule?