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

Interval splitAt produces an invalid interval during DST change #1537

Closed
zub0r opened this issue Nov 8, 2023 · 1 comment
Closed

Interval splitAt produces an invalid interval during DST change #1537

zub0r opened this issue Nov 8, 2023 · 1 comment

Comments

@zub0r
Copy link

zub0r commented Nov 8, 2023

Describe the bug
Interval splitAt produces an invalid interval during DST change

To Reproduce
https://stackblitz.com/edit/luxon-demos-tpff1z?file=index.ts

Actual vs Expected behavior
Interval splitAt should produce valid intervals during DST change

  • OS: Ubuntu
  • Browser Chrome
  • Luxon version 3.4.3
  • Your timezone Europe/Bratislava
@diesieben07
Copy link
Collaborator

This was already fixed by #1524, the fix will be in the next version of Luxon.
Until then you can work around this bug by converting all split-points to UTC:

const interval = Interval.fromISO('2023-10-29T01:00:00.000+02:00/2023-10-29T04:00:00.000+01:00');
const cutpoints = interval.splitBy({ hour: 1 }).map((i) => i.start.toUTC()); // <== Converting to UTC here
const cuts = interval.splitAt(...cutpoints);

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

2 participants