class ActiveSupport::Duration
def to_i
Time[https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision
Date[https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and
In such cases, Ruby's core
1.year.to_i # => 31556952
# equivalent to 365.2425.days.to_i
1.month.to_i # => 2629746
# equivalent to (1.year / 12).to_i
and years are 365.2425 days:
duration of some periods, e.g. months are always 1/12 of year
Note that this conversion makes some assumptions about the
1.day.to_i # => 86400
1.hour.to_i # => 3600
1.minute.to_i # => 60
Returns the number of seconds that this Duration represents.
def to_i @value.to_i end