Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2.3.8 ) is shown here.
time_with_datetime_fallback (utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0, usec=0)
public
Returns a new Time if requested year can be
accommodated by Ruby’s Time class (i.e., if
year is within either 1970..2038 or 1902..2038, depending on system
architecture); otherwise returns a DateTime
Show source # File activesupport/lib/active_support/core_ext/time/calculations.rb, line 44
def time_with_datetime_fallback(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0, usec=0)
::Time.send(utc_or_local, year, month, day, hour, min, sec, usec)
rescue
offset = utc_or_local.to_sym == :local ? ::DateTime.local_offset : 0
::DateTime.civil(year, month, day, hour, min, sec, offset)
end