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

Occurences are wrong when DTStart includes timezone

Reeywhaar opened this issue · comments

Reporting an issue

Given that we have:

const rule = RRule.fromString(
  `
DTSTART;TZID=America/Montreal:20111002T090000
RRULE:FREQ=WEEKLY
`.trim()
);

And then we want to find occurences:

rule
    .between(
      moment("2020-11-02T00:00:00+00:00").toDate(),
      moment("2020-12-09T00:00:00+00:00").toDate()
    )
    .map((o) => moment(o).clone().tz("Europe/London").format())
    .join("<br/>")

We get results that are off by timezone offset. America/Montreal is ~ -04:00. Europe/London is +00:00. Why do we get result that has offset of 8 hours between rrule initial timezone?

  • 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.
    https://codesandbox.io/p/sandbox/floral-cherry-53htrz?file=%2Fsrc%2Findex.ts%3A13%2C27
  • Expected output
    2020-11-08T13:00:00Z
    2020-11-15T13:00:00Z
    2020-11-22T13:00:00Z
    2020-11-29T13:00:00Z
    2020-12-06T13:00:00Z
  • Actual output
    2020-11-08T17:00:00Z
    2020-11-15T17:00:00Z
    2020-11-22T17:00:00Z
    2020-11-29T17:00:00Z
    2020-12-06T17:00:00Z
  • The version of rrule you are using
    2.8.1
  • Your operating system
    MacOS Sonoma
  • Your local timezone (run $ date from the command line
    of the machine showing the bug)
    Europe/Istanbul