mtdowling / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/
MIT License
4.89k stars 339 forks source link

Day vs Weekday Issue #11

Closed Fuelhead closed 12 years ago

Fuelhead commented 12 years ago

First of all: nice code, thanks for sharing!

On Sun, Feb 19 2012, I tested with '0 14 1 1,4,7,10 1', so each first monday of the months 1,4,7 and 10, at 14:00 a job has to start, and it returned an error.

The next run date for factory('0 14 1 1,4,7,10 1') started on Sun, Feb 19 2012, should have been 'Mon, Apr 02, 2012 14:00:00' and not 'Mon, Oct 01 2012 14:00:00' as returned.

It's a bit strange in itself: first request the first day of the month, than move over to the first monday. But hey, that's cron as we know it.

Thanks in advance & good luck!