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

Timezone.convert("Etc/GMT...") inconsistent with DateTime+Tzdata #685

Open
vovayartsev opened this issue Sep 2, 2021 · 0 comments
Open

Comments

@vovayartsev
Copy link

This is largely a duplicate of #649, but slightly different

Steps to reproduce

in your mix.exs:

  defp deps do
    [
      {:timex,"3.7.6"},
      {:tzdata, "~> 1.1"}
    ]
  end

then in the console:

DateTime.now("Etc/GMT-4")    
{:ok, #DateTime<2021-09-02 21:30:46.545885+04:00 +04 Etc/GMT-4>}

tried in PostgreSQL and it's consistent with DateTime + Tzdata:

postgres=# select now() at time zone 'Etc/GMT-4'
 2021-09-02 21:30:57.241963

but Timex gives a very different result

Timex.now() |> Timex.Timezone.convert("Etc/GMT-4")
#DateTime<2021-09-02 13:31:50.793031-04:00 -04 Etc/GMT+4>

Description of issue

I was executing the lines above from Europe/Samara in the evening, around 21:30. My timezone is UTC+04:00 and the corresponding Etc area is Etc/GMT-4 (according to tz database wiki)

image

I was expecting Timex.now() |> Timex.Timezone.convert("Etc/GMT-4") to give me my local time (~21:30)

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

1 participant