Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression of 30th/31th february throws ArgumentOutOfRangeException #106

Open
LuckyyyStrike opened this issue Nov 21, 2022 · 2 comments
Open

Comments

@LuckyyyStrike
Copy link

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?

@atifaziz
Copy link
Owner

atifaziz commented Nov 23, 2022

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.

@LuckyyyStrike
Copy link
Author

LuckyyyStrike commented Nov 24, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants