aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb2
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb3
2 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 82af1653ef..5933fc9667 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -63,7 +63,7 @@ module ActiveSupport
# Time uses #zone to display the time zone abbreviation, so we're duck-typing it
def zone
- period.abbreviation.to_s
+ period.zone_identifier.to_s
end
def inspect
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 085fab9731..91f0394472 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -177,6 +177,7 @@ class TimeZone
begin # the following methods depend on the tzinfo gem
require_library_or_gem "tzinfo" unless Object.const_defined?(:TZInfo)
+ raise LoadError unless TZInfo.const_defined?(:TimeOrDateTime)
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from given values. Example:
#
@@ -253,7 +254,7 @@ class TimeZone
rescue LoadError # Tzinfo gem is not available
# re-raise LoadError only when a tzinfo-dependent method is called:
%w(local at parse now today utc_to_local local_to_utc period_for_utc period_for_local tzinfo).each do |method|
- define_method(method) {|*args| raise LoadError, "TZInfo gem is required for TimeZone##{method}. `gem install tzinfo` and try again."}
+ define_method(method) {|*args| raise LoadError, "TZInfo version >= 0.2 is required for TimeZone##{method}(). `gem install tzinfo` and try again."}
end
end