Skip to content

Instantly share code, notes, and snippets.

@rodolfobandeira
Last active April 18, 2020 13:57
Show Gist options
  • Save rodolfobandeira/aefce9e4369facc801a2a77a90c36576 to your computer and use it in GitHub Desktop.
Save rodolfobandeira/aefce9e4369facc801a2a77a90c36576 to your computer and use it in GitHub Desktop.
Minimum Offset Timezone Difference Rails 5.1 and Rails 5.2

Rails 5.1:

ActiveSupport::TimeZone.new("International Date Line West")
<ActiveSupport::TimeZone:0x0000564eac8abac8
    @name="International Date Line West",
    @tzinfo=#<TZInfo::DataTimezone: Pacific/Midway>,
    @utc_offset=nil
>
ActiveSupport::TimeZone.new("International Date Line West").parse("2020-04-18").utc_offset
=> -39600

Rails 5.2

ActiveSupport::TimeZone.new("International Date Line West")
<ActiveSupport::TimeZone:0x00007f9754cf0ad8
  @name="International Date Line West",
  @tzinfo=#<TZInfo::DataTimezone: Etc/GMT+12>,
  @utc_offset=nil
>
ActiveSupport::TimeZone.new("International Date Line West").parse("2020-04-18").utc_offset
=> -43200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment