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

Dates on month and day of DTSTART that are after UNTIL date are included in output

informedfunction opened this issue · comments

For an rrule that starts on Sept 1 2022 and has an UNTIL value of July 1 2023, the between() method outputs Sept 1 2023, which is after the UNTIL date. Sept 1 is also outputted in 2024, 2025, and onward indefinitely.

Code sample:

const rules = rrulestr(DTSTART=20220901T080000\nRRULE:FREQ=MONTHLY;BYMONTHDAY=1;UNTIL=20230701T235959)
const recurrenceDates = rules
          .between(
            currentDateRange[0], // June 15 2023
            currentDateRange[1] // Sept 15 2023
         )
  • Expected output: July 1 2023
  • Actual output: July 1 2023, Sept 1 2023
  • Version of rrule: 2.7.2
  • Operating System: MacOS 13.4
  • Local timezone: GMT -6 (CDT)

Your rule isn't correct. You have something (\nRRULE:) that's preventing the rule from being completely parsed.

DTSTART=20220901T080000\nRRULE:FREQ=MONTHLY;BYMONTHDAY=1;UNTIL=20230701T235959

If you replace \nRRULE: for a semicolon it works perfectly.

DTSTART=20220901T080000;FREQ=MONTHLY;BYMONTHDAY=1;UNTIL=20230701T235959

image

https://codesandbox.io/s/proud-frog-h25np6?file=/src/App.js:356-427