1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Avoid dummy_time_value to add "2000-01-01" twice

This commit is contained in:
Yasuo Honda 2015-11-30 14:19:30 +00:00
parent 4687e59d5c
commit 589cef086f

View file

@ -29,7 +29,11 @@ module ActiveModel
return value unless value.is_a?(::String)
return if value.empty?
dummy_time_value = "2000-01-01 #{value}"
if value =~ /^2000-01-01/
dummy_time_value = value
else
dummy_time_value = "2000-01-01 #{value}"
end
fast_string_to_time(dummy_time_value) || begin
time_hash = ::Date._parse(dummy_time_value)