gorhill / cronexpr

Cron expression parser in Go language (golang)
683 stars 168 forks source link

Handling for day-of-week spans ending in seven #12

Open AirbornePorcine opened 8 years ago

AirbornePorcine commented 8 years ago

In the current implementation, day-of-week spans that end in seven (ie 5-7) will not generate any values when calling next. The underlying issue is that populateMany generates its list based on a for between min and max values, and we set Sunday/7 to be an equivalent max value of zero.

We weren't entirely sure how to fix it at that point, so we added a quick piece of logic to remap the zero value to six (Saturday) when the end of a day-of-week span is seven. Suggestions for a less hacky-feeling way of fixing this are welcome of course.

josegonzalez commented 7 years ago

@gorhill bump :)