I have need for an interval data type representing years, months, weeks, days, hours, minutes, seconds. The first three (years, months, days) can be done with Period
and the last three (hours, minutes, seconds) can be done with Duration
however none of them seem to do both. Ideally I'd like to avoid having to implement a custom TemporalAmount
.
There is a reason why there is no such type. There is no well defined time intervals such as "day", "month" or "year":
Even if you implement a custom TemporalAmount there is high chance that your code will be incorrect in some cases. If you state your actual requirements you might get a better answer.