aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type/helpers/time_value.rb
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2019-07-08 10:20:45 -0500
committerGitHub <noreply@github.com>2019-07-08 10:20:45 -0500
commitc00cd7b446aaeb8e2486142938238b26c48ed711 (patch)
treed33b5cb6ab8bf61f4f04ac5731c54a2336661461 /activemodel/lib/active_model/type/helpers/time_value.rb
parentfe30211574648fa21bff958a3cf952fd0c20c3b1 (diff)
parent84ff4f6ea2a118b47160e3fe7ed29bff52c2a7a2 (diff)
downloadrails-c00cd7b446aaeb8e2486142938238b26c48ed711.tar.gz
rails-c00cd7b446aaeb8e2486142938238b26c48ed711.tar.bz2
rails-c00cd7b446aaeb8e2486142938238b26c48ed711.zip
Merge branch 'master' into add_database_exist_method
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