class ActiveSupport::Duration

def in_years

30.days.in_years # => 0.082

Returns the amount of years a duration covers as a float
def in_years
  in_seconds / SECONDS_PER_YEAR.to_f
end