-
Notifications
You must be signed in to change notification settings - Fork 379
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
could_not_resolve_timezone error when converting a date during DST changeover #691
Comments
iex(11)> ~N[2021-03-14 01:59:59] |> Timex.Timezone.convert("America/Chicago")
#DateTime<2021-03-14 01:59:59-06:00 CST America/Chicago>
iex(12)> ~N[2021-03-14 02:00:00] |> Timex.Timezone.convert("America/Chicago")
{:error, {:could_not_resolve_timezone, "America/Chicago", 63782906400, :wall}}
iex(13)> ~N[2021-03-14 02:59:59] |> Timex.Timezone.convert("America/Chicago")
{:error, {:could_not_resolve_timezone, "America/Chicago", 63782909999, :wall}}
iex(14)> ~N[2021-03-14 03:00:00] |> Timex.Timezone.convert("America/Chicago")
#DateTime<2021-03-14 03:00:00-05:00 CDT America/Chicago> I've also caught it. It seems very surprising when out of context. |
This bit me today: iex(5)> ~N[2022-03-13 02:37:00] |> Timex.to_datetime("America/Los_Angeles")
{:error, {:could_not_resolve_timezone, "America/Los_Angeles", 63814358220, :wall}} |
+1 as this bit us in prod. STR
iex(1)> DateTime.utc_now()
~U[2022-04-03 02:33:27.785095Z]
iex(2)> Timex.Timezone.get("America/Los_Angeles"
#<TimezoneInfo(America/Los_Angeles - PDT (-07:00:00))>
iex(3)> Timex.Timezone.get("America/Mexico_City")
{:error, {:could_not_resolve_timezone, "America/Mexico_City", 63816172439, :wall}}
Though in my case we're not converting a date. We're asking for the abbreviation of a particular TZ but in this case we get the error tuple which is not ideal. |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this has been brought up in previous issues #555 and #625 but this doesn't seem to be resolved in the latest release 3.7.6 so I am creating a new issue.
Steps to reproduce
Convert a date between 2am and 3am on 3 October 2021 to "Australia/Melbourne" timezone.
Example:
~N[2021-10-03 02:31:07] |> Timex.Timezone.convert("Australia/Melbourne")
Output:
{:error, {:could_not_resolve_timezone, "Australia/Melbourne", 63800447467, :wall}}
This looks to be a DST issue, because the following (an hour earlier, before the DST switch) works:
~N[2021-10-03 01:31:07] |> Timex.Timezone.convert("Australia/Melbourne")
Output:
#DateTime<2021-10-03 01:31:07+10:00 AEST Australia/Melbourne>
Daylight saving time Melbourne began at 2:00 am on Sunday, 3 October 2021. The error occurs any trying to convert a date anytime between 2am and 3am.
What are the expected results?
I expect the date will be converted to a timezone without an error regardless of whether the time is in a DST changeover period or not for the given timezone.
Thanks for any assistance! - Ian
The text was updated successfully, but these errors were encountered: