Module | ActiveSupport::CoreExtensions::DateTime::Calculations |
In: |
lib/active_support/core_ext/date_time/calculations.rb
|
Enables the use of time calculations within DateTime itself
Uses Date to provide precise Time calculations for years, months, and days. The options parameter takes a hash with any of these keys: :years, :months, :weeks, :days, :hours, :minutes, :seconds.
Returns a new DateTime where one or more of the elements have been changed according to the options parameter. The time options (hour, minute, sec) reset cascadingly, so if only the hour is passed, then minute and sec is set to 0. If the hour and minute is passed, then sec is set to 0.
Layers additional behavior on DateTime#<=> so that Time and ActiveSupport::TimeWithZone instances can be compared with a DateTime