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

Monthly recurrence rule is generating 2 appointments on same day due to daylight saving change #398

Closed
otzy007 opened this issue Jun 7, 2017 · 3 comments
Labels

Comments

@otzy007
Copy link

otzy007 commented Jun 7, 2017

Hi,

I've found an interesting case on both v 0.12.1 and master where for a recurrence rule there are 2 appointments created on the same day Sun, 05 Nov 2017 01:00:00 AKDT -08:00, Sun, 05 Nov 2017 01:00:00 AKST -09:00.

I suppose this has something to do with daylight saving time.

The code to reproduce this issue is

      Time.zone = "UTC"
      
      r = Rule.monthly.day_of_month(5)

      ocurrences_date_from = Time.zone.parse('Fri, 05 May 2017 19:11:17 UTC +00:00')
      schedule = IceCube::Schedule.new
      schedule.add_recurrence_rule r
      schedule.start_time = Time.zone.parse("Wed, 05 Oct 2016 09:00:00 UTC +00:00").in_time_zone('America/Nome')

      p schedule.occurrences_between(ocurrences_date_from, ocurrences_date_from +  16.months)

and the output is

[Mon, 05 Jun 2017 01:00:00 AKDT -08:00, Wed, 05 Jul 2017 01:00:00 AKDT -08:00, Sat, 05 Aug 2017 01:00:00 AKDT -08:00, Tue, 05 Sep 2017 01:00:00 AKDT -08:00, Thu, 05 Oct 2017 01:00:00 AKDT -08:00, Sun, 05 Nov 2017 01:00:00 AKDT -08:00, Sun, 05 Nov 2017 01:00:00 AKST -09:00, Tue, 05 Dec 2017 01:00:00 AKST -09:00, Fri, 05 Jan 2018 01:00:00 AKST -09:00, Mon, 05 Feb 2018 01:00:00 AKST -09:00, Mon, 05 Mar 2018 01:00:00 AKST -09:00, Thu, 05 Apr 2018 01:00:00 AKDT -08:00, Sat, 05 May 2018 01:00:00 AKDT -08:00, Tue, 05 Jun 2018 01:00:00 AKDT -08:00, Thu, 05 Jul 2018 01:00:00 AKDT -08:00, Sun, 05 Aug 2018 01:00:00 AKDT -08:00, Wed, 05 Sep 2018 01:00:00 AKDT -08:00]

As you can see there are 2 appointments on 5th of November: Sun, 05 Nov 2017 01:00:00 AKDT -08:00, Sun, 05 Nov 2017 01:00:00 AKST -09:00

Any hints on why this could happen? Or how we can fix it?

@toxaq
Copy link

toxaq commented Jun 11, 2017

Have you seen #335 ? Timezones not fully supported but no decision was made about using ActiveSupport solution offered...

@avit
Copy link
Collaborator

avit commented Jun 25, 2017

Thanks, closing as a duplicate.

If you load ActiveSupport and use ActiveSupport::TimeWithZone objects (Time.zone.now etc.), then it will work correctly.

@avit avit closed this as completed Jun 25, 2017
@avit
Copy link
Collaborator

avit commented Jun 25, 2017

Actually, reading this again it looks like that's what you're doing. I'll have a closer look.

@avit avit reopened this Jun 25, 2017
@avit avit added the bug label Jun 29, 2017
@avit avit closed this as completed in 4371d53 Jul 10, 2017
avit added a commit that referenced this issue Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants