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/values/time_zone.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 71e8528ae1..cd4b84bdc7 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -45,7 +45,7 @@ class TimeZone
# Adjust the given time to the time zone represented by +self+.
def adjust(time)
- time = time.to_time
+ time = time.to_time unless time.is_a?(::Time)
time + utc_offset - time.utc_offset
end
@@ -53,8 +53,9 @@ class TimeZone
# zone, and then adjusts it to return the corresponding time in the
# local time zone.
def unadjust(time)
- time = Time.local(*time.to_time.to_a)
- time - utc_offset + time.utc_offset
+ time = time.to_time unless time.is_a?(::Time)
+ time = time.localtime
+ time - utc_offset - time.utc_offset
end
# Compare this time zone to the parameter. The two are comapred first on