dragonmantank / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
MIT License
4.57k stars 124 forks source link

Weekdays not being parsed correctly #107

Closed kraepelien closed 3 years ago

kraepelien commented 3 years ago

I'm using the following expression, and it's giving me duplicates instead of once per day, excluding weekends. Since there are duplicates, it never reaches the weekend.

Expression: 0 7 /1 1-5 ->getMultipleRunDates(7) yields: [0] => 2021-02-16 07:00:00.000000 [1] => 2021-02-16 07:00:00.000000 [2] => 2021-02-17 07:00:00.000000 [3] => 2021-02-17 07:00:00.000000 [4] => 2021-02-18 07:00:00.000000 [5] => 2021-02-18 07:00:00.000000 [6] => 2021-02-19 07:00:00.000000

Expected result: [0] => 2021-02-16 07:00:00.000000 [1] => 2021-02-17 07:00:00.000000 [3] => 2021-02-18 07:00:00.000000 [4] => 2021-02-19 07:00:00.000000 [5] => 2021-02-22 07:00:00.000000 [6] => 2021-02-23 07:00:00.000000 [7] => 2021-02-24 07:00:00.000000