aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type/time.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/type/time.rb')
-rw-r--r--activemodel/lib/active_model/type/time.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/type/time.rb b/activemodel/lib/active_model/type/time.rb
index c094ee0013..b3056b1333 100644
--- a/activemodel/lib/active_model/type/time.rb
+++ b/activemodel/lib/active_model/type/time.rb
@@ -18,6 +18,8 @@ module ActiveModel
case value
when ::String
value = "2000-01-01 #{value}"
+ time_hash = ::Date._parse(value)
+ return if time_hash[:hour].nil?
when ::Time
value = value.change(year: 2000, day: 1, month: 1)
end