class Numeric
def seconds
# equivalent to Time.current.advance(months: 4, years: 5)
2.years.from_now
# equivalent to Time.current.advance(years: 2)
1.month.from_now
# equivalent to Time.current.advance(months: 1)
as well as adding or subtracting their results from a Time object. For example:
These methods use Time#advance for precise date calculations when using from_now, ago, etc.
Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years.
def seconds ActiveSupport::Duration.new(self, [[:seconds, self]]) end