5

I am seeing some strange results whilst trying to retrieve the time zone for Ireland.

On Mac OS X (without tzinfo-data)

include ActionView::Helpers::FormOptionsHelper
time_zone_options_for_select.split.select { |opt| opt =~ /Dublin/ }

=> ["value=\"Dublin\">(GMT+00:00)", "Dublin</option>"]

Then on Ubuntu I get:

=> ["value=\"Dublin\">(GMT+01:00)", "Dublin</option>"]

Then, on Mac OS X with 'tzinfo-data' I get:

=> ["value=\"Dublin\">(GMT+01:00)", "Dublin</option>"]

Ireland is GMT+0 (the offsets don't include DST, London is currently report +0 and Madrid +1, but as I write both as those are using +1 and +2 (BST and CEST))

Why am I getting GMT+1 on Ubuntu or with tzinfo-data?

Edit:

Ok, I have some results without rails Using tzinfo-data 1.2018.4

> require 'tzinfo/data'
> TZInfo::Timezone.get('Europe/Dublin').current_period.utc_offset
=> 0

using tzinfo-data 1.2018.5

> require 'tzinfo/data'
> TZInfo::Timezone.get('Europe/Dublin').current_period.utc_offset
=> 3600
Sam Stickland
  • 637
  • 1
  • 6
  • 17
  • The offsets should indeed include DST. You can try it by using for example by using the [timecop gem](https://github.com/travisjeffery/timecop) to simulate another date and then looking up the timezone information again. – Marcus Ilgner Oct 18 '18 at 19:30
  • But I don't see timezone offsets for other areas. For example: > time_zone_options_for_select.split.select { |opt| opt =~ /London|Madrid|Paris/ } => ["value=\"London\">(GMT+00:00)", "London", "value=\"Madrid\">(GMT+01:00)", "Madrid", "value=\"Paris\">(GMT+01:00)", "Paris"] The actual offset in use in those places are +1, +2 and +2 – Sam Stickland Oct 18 '18 at 19:48

1 Answers1

4

I found the problem. It turns out the Ireland actually uses a negative offset in winter, not a positive offset in summer (it's currently the only country in the world to do this).

The latest IANA timezone release 2018f correctly uses a negative offset for Ireland, while earlier (released) versions were using a different base timezone and a positive offset during summer.

Sam Stickland
  • 637
  • 1
  • 6
  • 17
  • 1
    THANK YOU. I thought I was going crazy today with the differences between running tests on my mac locally and on my ubuntu server in prod. – Isaiah Fasoldt May 11 '20 at 17:10