Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tzinfo-data + Rails is reporting the wrong timezone offset for ireland

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
like image 347
Sam Stickland Avatar asked Oct 18 '18 19:10

Sam Stickland


1 Answers

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.

like image 109
Sam Stickland Avatar answered Nov 02 '22 23:11

Sam Stickland