Skip to content

Time.at in (Ruby 2.6) returns UTC instead of local time with a TZInfo::Timezone #6229

Closed

Description

@philr

Environment Information

jruby -v:
jruby 9.3.0.0-SNAPSHOT (2.6.5) 2020-05-15 87104fd OpenJDK 64-Bit Server VM 25.252-b09 on 1.8.0_252-8u252-b09-1~19.10-b09 +jit [linux-x86_64]

uname -a:
Linux linuxdev 5.3.0-51-generic #44-Ubuntu SMP Wed Apr 22 21:09:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Ubuntu 19.10

With the tzinfo v2.0.2 and tzinfo-data v1.2020.1 gems installed:

gem install tzinfo:2.0.2 tzinfo-data:1.2020.1

Expected Behaviour

With MRI 2.6.6, Time.at with a TZInfo::Timezone provided as the in: option returns a Time representing a local instant. For example:

$ ruby -rtzinfo -e"t=Time.at(1589711100, in: TZInfo::Timezone.get('Europe/Paris')); p t"
2020-05-17 12:25:00 +0200

Actual Behaviour

JRuby head (tested at commit 87104fd) returns a UTC instant instead:

$ jruby -rtzinfo -e"t=Time.at(1589711100, in: TZInfo::Timezone.get('Europe/Paris')); p t"
2020-05-17 10:25:00 UTC

Activity

  1. jeremyevans commented on Oct 13, 2022

    @jeremyevans
    Contributor

    This issue has been fixed. In 9.3.8.0:

    Time.at(1589711100, in: TZInfo::Timezone.get('Europe/Paris'))
    # => 2020-05-17 12:25:00 +0200
  2. added this to the JRuby 9.3.8.0 milestone on Oct 13, 2022
  3. enebo commented on Oct 13, 2022

    @enebo
    Member

    Marking against last result because I am too lazy to see if it happened before 9.3.8.0. Thanks for letting us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions