Hi! Would it be valuable to add some convenience methods to Duration to convert the value to years, months, days?
Ex:
1.week.to_days
=> 7
3.days.to_weeks
=> 0.429
40.hours.to_days
=> 1.67
I wanted to check here before I work on a PR.
Thanks!
1 Like
1.week.days
is what you’re looking for. I don’t think an alias would be necessarily bad, though. It’s similarly done elsewhere.
I think 1.week.days does not yield the desired result. It is the equivalent of 1.week.to_i.days or 604800 days. The other time period name helper methods would produce analogous results.