aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type/helpers/time_value.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/type/helpers/time_value.rb')
-rw-r--r--activemodel/lib/active_model/type/helpers/time_value.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/type/helpers/time_value.rb b/activemodel/lib/active_model/type/helpers/time_value.rb
index 508fe77531..075e906034 100644
--- a/activemodel/lib/active_model/type/helpers/time_value.rb
+++ b/activemodel/lib/active_model/type/helpers/time_value.rb
@@ -11,10 +11,10 @@ module ActiveModel
value = apply_seconds_precision(value)
if value.acts_like?(:time)
- zone_conversion_method = is_utc? ? :getutc : :getlocal
-
- if value.respond_to?(zone_conversion_method)
- value = value.send(zone_conversion_method)
+ if is_utc?
+ value = value.getutc if value.respond_to?(:getutc) && !value.utc?
+ else
+ value = value.getlocal if value.respond_to?(:getlocal)
end
end