Skip to content

library does not respect DST boundaries (no timezone awareness) #14

Open
@bgentry

Description

@bgentry

In the following example:

iex(47)> {:ok, last_time, _} = DateTime.from_iso8601("2018-11-02T12:04:07Z")                                                
{:ok, #<DateTime(2018-11-02T12:04:07Z Etc/UTC)>, 0}

iex(48)> last_time = Timex.Timezone.convert(last_time, "America/Los_Angeles")                                               
#<DateTime(2018-11-02T05:04:07-07:00 America/Los_Angeles)>

iex(49)> RecurringEvents.take(last_time, %{freq: :daily, by_hour: 3, by_minute: 0, by_second: 0}, 5)                        
[#<DateTime(2018-11-02T05:04:07-07:00 America/Los_Angeles)>,
 #<DateTime(2018-11-03T03:00:00-07:00 America/Los_Angeles)>,
 #<DateTime(2018-11-04T03:00:00-07:00 America/Los_Angeles)>,
 #<DateTime(2018-11-05T03:00:00-07:00 America/Los_Angeles)>,
 #<DateTime(2018-11-06T03:00:00-07:00 America/Los_Angeles)>]

I'm starting with a time that's just before the US daylight saving time switch (Sunday Nov 4th), and explicitly setting it to America/Los_Angeles (UTC-7). The correct behavior would, I think, have the following value for Nov 4th:

2018-11-04T03:00:00-08:00 America/Los_Angeles)

The intention of the provided arguments is to have an event that repeats at 3am every day in the given timezone. But since this package has no timezone or DST awareness, it continues with a UTC-7 offset even though the specified zone has switched to UTC-8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions