Open Tiscan76 opened 1 year ago
From https://github.com/dragonmantank/cron-expression/blob/102b869b989d2867b5f05248cedbfa6604aa3a0a/src/Cron/DayOfWeekField.php#L16-L17 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.
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 calculate5:00 at the last weekday of the month
and then executegetNextRunDate('2023-10-01 00:00:00')
I would expect this function to return2023-10-31 05:00:00
but it returns2023-10-02 05:00:00
.If i change it to
getNextRunDate('2023-10-03 00:00:00')
the result changes to2023-12-30 05:00:00
.Is this a bug or did I misunderstand how LW is supposed to work?