jkbrzt/rrule

RRrule timezone issue

PaulinaPogorzelska opened this issue · 0 comments

Reporting an issue

I store dates in UTC.
For example 2023-10-20T07:00:00.000Z. With RRule i wanna create occurrences in user specified timezone and display them in UTC again.

import { RRule, datetime } from "rrule";

const count = 30;
const freq = RRule.DAILY;

const dtstart = datetime(2023, 10, 20, 7);
console.log(dtstart);

const rule = new RRule({
  dtstart,
  count,
  freq,
  tzid: "America/Los_Angeles"
});

console.log({
  all: rule.all().map((d) => new Date(d).toUTCString())
});

Expected output:
Dates after daylight change should have 1 hour offset which happens only for couple days and from 6th is again wrong
Expected output would be until 29th
Actual output:
Screenshot 2023-11-09 at 19 24 03

Version of Rrule: 2.7.1
Your operating system: MacOS monterey 12.3
Your local timezone: Thu Nov 9 19:25:24 CET 2023