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

Daily recurrence skips 2 days on DST. #165

Open
ricksuggs opened this issue Jan 17, 2024 · 1 comment
Open

Daily recurrence skips 2 days on DST. #165

ricksuggs opened this issue Jan 17, 2024 · 1 comment

Comments

@ricksuggs
Copy link

Daily recurrence skips 2 days when starts is a local DateTime (ActiveSupport::TimeWithZone) with DST.

When the daily recurrence starts on a local DateTime (ActiveSupport::TimeWithZone) with DST between 2:00am and 2:59:59am, 2 days are skipped on "spring forward". Skipping one day may be reasonable, since the time officially switches over at 2:00am, but why would 2 days be skipped?

Example:

[4] pry(main)> r = Montrose.every(:day, at: '2:00:00', starts: DateTime.new(2024, 3, 8).in_time_zone('America/Los_Angeles'))
=> #<Montrose::Recurrence:2f684 {:every=>:day, :starts=>Thu, 07 Mar 2024 16:00:00.000000000 PST -08:00, :at=>[[2, 0, 0]]}>
[5] pry(main)> e = r.events.take(10)
=> [Fri, 08 Mar 2024 02:00:00.000000000 PST -08:00,
 Sat, 09 Mar 2024 02:00:00.000000000 PST -08:00,
 Tue, 12 Mar 2024 02:00:00.000000000 PDT -07:00,
 Wed, 13 Mar 2024 02:00:00.000000000 PDT -07:00,
 Thu, 14 Mar 2024 02:00:00.000000000 PDT -07:00,
 Fri, 15 Mar 2024 02:00:00.000000000 PDT -07:00,
 Sat, 16 Mar 2024 02:00:00.000000000 PDT -07:00,
 Sun, 17 Mar 2024 02:00:00.000000000 PDT -07:00,
 Mon, 18 Mar 2024 02:00:00.000000000 PDT -07:00,
 Tue, 19 Mar 2024 02:00:00.000000000 PDT -07:00]
@rossta
Copy link
Owner

rossta commented Jun 20, 2024

Thanks for the report. I haven’t had a chance to look into this yet. PRs are welcome!

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