mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Year 0 should fall to nil only if month and day are also 0
This commit is contained in:
@@ -189,7 +189,7 @@ module ActiveRecord
|
||||
|
||||
def new_time(year, mon, mday, hour, min, sec, microsec)
|
||||
# Treat 0000-00-00 00:00:00 as nil.
|
||||
return nil if year.nil? || year == 0
|
||||
return nil if year.nil? || (year == 0 && mon == 0 && mday == 0)
|
||||
|
||||
Time.time_with_datetime_fallback(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user