Skip to content

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

Closed
@otzy007

Description

@otzy007

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions