For our iso8601 intervals, it has the current flaws:
Computing years doesn't take into account leap days
To calculate month intervals it uses time.Now() which precludes mocking.
It seems like we want to use time.AddDate() to let Go do the heavy-lifting on what it means to add months and years, which requires an (internal) API change.
// Instead of this:
dur := iso8601.FromString("P1M")
now := time.Now()
later := now.Add(dur.ToDuration())
// We do this:
dur := iso8601.FromString("P1M")
now := time.Now()
later := dur.Add(now)
For our iso8601 intervals, it has the current flaws:
time.Now()
which precludes mocking.It seems like we want to use
time.AddDate()
to let Go do the heavy-lifting on what it means to add months and years, which requires an (internal) API change.