From a0cc94b32e5b4e4dce50787eed1208406f99ea82 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 15 Apr 2010 01:10:04 -0300 Subject: utc_offset returns nil for unknown zones Signed-off-by: Jeremy Kemper --- activesupport/lib/active_support/values/time_zone.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 03b324764b..9db6bbafca 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/object/try' # The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following: # @@ -205,8 +206,8 @@ module ActiveSupport if @utc_offset @utc_offset else - @current_period ||= tzinfo.current_period - @current_period.utc_offset + @current_period ||= tzinfo.try(:current_period) + @current_period.try(:utc_offset) end end -- cgit v1.2.3