whenever
whenever copied to clipboard
Improving the `[Date|Time|DateTime]Delta` API
There are two design questions for DateDelta
:
- Currently,
DateDelta
stores years, months, weeks, and days separately. However, in the Gregorian calandar, years are always 12 months, and weeks are always 7 days. It's save on storage to just storemonths
anddays
. The downside is that users may want to deliberately store unnormalized deltas, such that "24 months" isn't the same as "2 years". - On a related note, the
DateDelta
components may have different signs (P4Y-3M+1W0D
). While this is certainly flexible, it's unclear whether this functionality is actually used. Having one single sign would simplify things—although it may result in exceptions when doing arithmetic (whetheryears(a) + months(b) - years(c)
would raise an exception depending on whether the result would have mixed signs).