tzinfo-data + Rails 报告了错误的爱尔兰时区偏移量

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

我在尝试检索爱尔兰时区时看到一些奇怪的结果。

在 Mac OS X(没有 tzinfo 数据)

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

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

然后在 Ubuntu 我得到:

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

然后,在 Mac OS X 上 'tzinfo-data' 我得到:

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

爱尔兰是 GMT+0(偏移量不包括夏令时,伦敦目前报告为 +0,马德里报告为 +1,但正如我所写的,因为它们使用的是 +1 和 +2(BST 和 CEST))

为什么我在 Ubuntu 或 tzinfo-data 上得到 GMT+1?

编辑:

好的,我有一些结果没有 rails 使用 tzinfo-data 1.2018.4

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

使用 tzinfo-data 1.2018.5

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

我发现了问题。事实证明,爱尔兰实际上在冬天使用负偏移,而不是在夏天使用正偏移(它是目前世界上唯一这样做的国家)。

最新的 IANA 时区版本 2018f 正确地使用了爱尔兰的负偏移,而早期(发布的)版本在夏季使用不同的基准时区和正偏移。