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.31k stars 511 forks source link

UNTIL is miscalculated when DTSTART has timezone (TZID) #596

Open zachi opened 1 year ago

zachi commented 1 year ago

Hi, When DTSTART has timezone (TZID), and UNTIL is in UTC time (how it should be following in the spec). the library mistakenly regarding it as in local time. which leads to wrong events output

example

using this RRULE RRule.fromString('DTSTART;TZID=Asia/Jerusalem:20230805T123000\nRRULE:FREQ=WEEKLY;UNTIL=20230819T093000Z').all() ends up with only 2 events:

when it should render one more event (2023-08-19T12:30:00.000Z)

specification

If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.

a live example

https://codesandbox.io/embed/rrule-forked-39whj8?fontsize=14&hidenavigation=1&theme=dark

origin python lib is behaving correctly and resulting with the correct events. please see the following example https://www.online-python.com/TY1pxQZaGr

using version 2.7.2, macOS 13.4.1 (c) local timezone: Israel Daylight Time

Thanks Zach