ajvb / kala

Modern Job Scheduler
MIT License
2.12k stars 187 forks source link

Improve Date Interval Handling #203

Closed tooolbox closed 4 years ago

tooolbox commented 4 years ago

For our iso8601 intervals, it has the current flaws:

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)