在尝试检索爱尔兰的时区时,我看到了一些奇怪的结果。
在 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-data
1.2018.4的 rails 的结果
> 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