Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source
Show
Ignore:
Timestamp:
02/16/08 20:13:38 (7 months ago)
Author:
gbuesing
Message:

Refactor ActiveRecord::ConnectionAdapters::Column.new_time: leverage DateTime failover behavior of Time#time_with_datetime_fallback

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

    r8870 r8881  
    173173            # Treat 0000-00-00 00:00:00 as nil. 
    174174            return nil if year.nil? || year == 0 
    175  
    176             Time.send(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) 
    177           # Over/underflow to DateTime 
    178           rescue ArgumentError, TypeError 
    179             zone_offset = Base.default_timezone == :local ? DateTime.local_offset : 0 
    180             DateTime.civil(year, mon, mday, hour, min, sec, zone_offset) rescue nil 
     175             
     176            Time.time_with_datetime_fallback(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil 
    181177          end 
    182178