jmrozanec / cron-utils

Cron utils for parsing, validations and human readable descriptions as well as date/time interoperability.
http://cron-utils.com
Apache License 2.0
1.15k stars 262 forks source link

DOM list including "L" does not behave as expected #539

Open kristofarkas opened 2 years ago

kristofarkas commented 2 years ago

A cron expression for every 15th and last day of the month at 12:00 does not behave as expected and skips the last days when asked for next execution time.

Example cron schedule: 0 0 L,15 * *

While the cron expression is "valid" I wonder if this is in fact not supported.

jmrozanec commented 2 years ago

@kristofarkas, thank you for reporting this. May we ask you for a PR with a test reproducing the issue? Thanks! 😄

kristofarkas commented 2 years ago

Hey @jmrozanec! Here is a repro: https://github.com/jmrozanec/cron-utils/pull/540/files

mccartney commented 2 years ago

(just a lurker, not part of the project, just trying to help)

"valid" I wonder if this is in fact not supported.

The README for this project says:

Non-standard characters L, W, LW, '?' and # are supported as well!

so I think the intent is for L to be supported.

kristofarkas commented 2 years ago

When using the ‘L’ option, it is important not to specify lists, or ranges of values, as you’ll get confusing/unexpected results.

This quote is from the quarz cron tutorial here: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html. Is L,15 a list? And if so does it fall under the this quote?

kristofarkas commented 2 years ago

Any thoughts on this @jmrozanec? I could contribute a fix (if this is indeed a bug) with some help from you on where to look.

jmrozanec commented 2 years ago

@kristofarkas, if the expression is valid, it must be supported as defined in the specification. We will be glad to merge a PR with a valid fix 😄 Thanks!