Closed jwoertink closed 2 years ago
MonthSpan is a different thing from Time::Span, eh. Crystals date math might be able to rescue this situation by changing the way the math is calculated. As is, simply adding MonthSpan will fail:
(Here 45.days.ago is the "last run time" in this code and 1.month is the interval)
p (Time.utc - 45.days.ago) > 1.month
=> Error: no overload matches 'Time::Span#>' with type Time::MonthSpan
Buuuuuuuut
p (45.days.ago + 1.month) <= Time.utc
=> true
There might be a little fuzz around the math but the way crystal is incrementing the month number seems like it'll usually work well enough.
This one might be a little tricky since months change length. For now, using
30.days
works.Crystal 1.1.1 Mosquito 0.11.0