atifaziz / NCrontab

Crontab for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TryParse and Parse returns altered schedule when interval is out of range

Atrejoe opened this issue · comments

Expression */250 * * * * in some dialects means every 250 minutes.
NCrontab does not support this expression, which is not what my issue is about.

When trying to validate this expression, using CrontabSchedule.TryParse("*/250 * * * *"), this (silently) returns an hourly schedule (0 * * * *) instead instead of null.
Also CrontabSchedule.Parse("*/250 * * * *") returns this hourly schedule.

see also #11 (comment)

I created a pull request, this may be debatable.
see: #53

I can image that a schedule like 'every 250 minutes' should still be supported.

*/250 * * * * means at every 250th minute. The returned schedule isn't altered, it is lowered. The * in */250 is like saying 0-59 so the returned schedule will occur at minute 0 but no other minute after that since it would be out of range; in effect, the returned/lowered schedule is 0 * * * *. This is not much different than 5-10/10 * * * * being lowered to 5 * * * * or 5-30/10 * * * * to 5,15,25 * * * *.

I am closing this as by-design (there is no bug as lacking validation of interval being out of range).