5

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

在 Mac OS X 上(没有 tzinfo-data)

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>"]

然后,在带有“tzinfo-data”的 Mac OS X 上,我得到:

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

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

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

编辑:

好的,我有一些没有使用tzinfo-data1.2018.4的 rails 的结果

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

使用tzinfo-data1.2018.5

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

1 回答 1

4

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

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

于 2018-10-18T21:15:42.217 回答