Skip to content
Browse files

Merge pull request #1097 from kirillrdy/master

Improved "treat  0000-00-00 00:00:00 as nil Date"
  • Loading branch information...
2 parents feddf31 + 6f0ebe0 commit 2c08a7485581ee423f6d558ddb613b46c7da8c09 @NZKoz NZKoz committed May 19, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/connection_adapters/column.rb
View
2 activerecord/lib/active_record/connection_adapters/column.rb
@@ -189,7 +189,7 @@ def new_date(year, mon, mday)
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

0 comments on commit 2c08a74

Please sign in to comment.
Something went wrong with that request. Please try again.