Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exdates returning UTC date without TZID offset #607

Open
7 tasks done
Lawton opened this issue Nov 14, 2023 · 4 comments
Open
7 tasks done

Exdates returning UTC date without TZID offset #607

Lawton opened this issue Nov 14, 2023 · 4 comments

Comments

@Lawton
Copy link

Lawton commented Nov 14, 2023

Reporting an issue

I am finding that an rruleset with exclusion dates returns dates without the offset of the timezone within the rruleset.

Example

var r = rrule.rrulestr('DTSTART;TZID=America/New_York:20231114T220000\nRRULE:UNTIL=20231118T220000;INTERVAL=1;FREQ=DAILY\nEXDATE;TZID=America/New_York:20231116T220000');
r.all()
/**
output : [
  2023-11-15T03:00:00.000Z,
  2023-11-16T03:00:00.000Z,
  2023-11-18T03:00:00.000Z,
  2023-11-19T03:00:00.000Z
] ✅ 
*/
r.exdates()
// expected: [ 2023-11-17T03:00:00.000Z ]

// actual: [ 2023-11-16T22:00:00.000Z ]

rrules version: 2.7.2

operating system: macOS 14

timezone: EST

Is this expected behaviour? It seems strange that exdates are not consistent with the instances. Thanks!


Thank you for taking an interest in rrule! Please include the following in
your report:

  • 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.
  • Expected output
  • Actual output
  • The version of rrule you are using
  • Your operating system
  • Your local timezone (run $ date from the command line
    of the machine showing the bug)
@dkelsen
Copy link

dkelsen commented Dec 9, 2023

I noticed this as well.

@sdotson
Copy link

sdotson commented Mar 25, 2024

Same

@vkartaviy
Copy link

+1 having the same issue :(

@SijmenHuizenga
Copy link

In an attempt to understand if/how our project is impacted by this report, i wrote below tests. Tests were ran UTC timezone. I see the same situation as described in the issue. Running rrule version 2.8.1.

describe("rrule exdates in timezones", () => {
  it("exdates should return dates in local timezone", () => {
    var r = rruleSdk.rrulestr(
      `DTSTART;TZID=America/New_York:20231114T220000
      RRULE:UNTIL=20231118T220000;INTERVAL=1;FREQ=DAILY
      EXDATE;TZID=America/New_York:20231116T220000`
    ) as rruleSdk.RRuleSet;
    expect(r.all()).toEqual([
      new Date("2023-11-15T03:00:00.000Z"),
      new Date("2023-11-16T03:00:00.000Z"),
      new Date("2023-11-18T03:00:00.000Z"),
      new Date("2023-11-19T03:00:00.000Z"),
    ]);
    expect(r.exdates()).toEqual([new Date("2023-11-17T03:00:00.000Z")]);
  });

  it("re-creating an rruleset should maintain the exdates", () => {
    const rrule = `DTSTART;TZID=America/New_York:20231114T220000
RRULE:UNTIL=20231118T220000;INTERVAL=1;FREQ=DAILY
EXDATE;TZID=America/New_York:20231116T220000`;
    var original = rruleSdk.rrulestr(rrule) as rruleSdk.RRuleSet;

    const copy = new rruleSdk.RRuleSet();
    original.rrules().forEach((r) => copy.rrule(r));
    original.exdates().forEach((exdate) => copy.exdate(exdate));

    expect(rrule).toEqual(copy.toString());
  });
});
  rrule exdates in timezones
    ✕ exdates should return dates in local timezone (10 ms)
    ✓ re-creating an rruleset should maintain the exdates

  ● rrule exdates in timezones › exdates should return dates in local timezone

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Array [
    -   2023-11-17T03:00:00.000Z,
    +   2023-11-16T22:00:00.000Z,
      ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants