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

DayOfMonth: (how) does LW work? #168

Open
Tiscan76 opened this issue Oct 17, 2023 · 1 comment
Open

DayOfMonth: (how) does LW work? #168

Tiscan76 opened this issue Oct 17, 2023 · 1 comment

Comments

@Tiscan76
Copy link

I was messing with PHP 7.4.3 and v3.3.3 of the library and I'm not entirely sure if i'm doing something wrong or if the calculation is broken.

If i use the cron-expression 0 5 LW * * to calculate 5:00 at the last weekday of the month and then execute getNextRunDate('2023-10-01 00:00:00') I would expect this function to return 2023-10-31 05:00:00 but it returns 2023-10-02 05:00:00.

If i change it to getNextRunDate('2023-10-03 00:00:00') the result changes to 2023-12-30 05:00:00.

Is this a bug or did I misunderstand how LW is supposed to work?

@mabar
Copy link

mabar commented Mar 4, 2024

From

* 'L' stands for "last". It allows you to specify constructs such as
* "the last Friday" of a given month.
I guess it means last wednesday and not last weekday as in Quartz Scheduler (in which I found this feature, is it also somewhere else?)
Even with that in mind, it looks like a bug, because it does not match last wednesday. Also it is not a standard cron syntax and it's better to not use it.

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