atifaziz / NCrontab

Crontab for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expression of 30th/31th february throws ArgumentOutOfRangeException

LuckyyyStrike opened this issue · comments

Steps to reproduce

Call GetNextOccurence() on a parsed expression of this format: "0 0 30 2 *"

Description

Obviously the 30th/31th february does not exist. Why does this expression even parse succcessfully, when an expression like "0 0 32 * *" does not?

Why does this expression even parse succcessfully

Because it's valid per the expression rules. The rule says the day field can go from 1 to 31 irrespective of the month or the other fields. Thing is, if you have an expression like 0 0 30 1-6 * that says midnight on the 30th of the first 6 months then February will be skipped.

Why does this expression even parse succcessfully

Because it's valid per the expression rules. The rule says the day field can go from 1 to 31 irrespective of the month or the other fields. Thing is, if you have an expression like 0 0 30 1-6 * that says midnight on the 30th of the first 6 months then February will be skipped.

Makes sense

Issue 21 talks about the same problem that occurs here. There, the issue was resolved by returning the endDate argument when calling GetNextOccurences. Wouldn't it make sense to do the same here?