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.9k stars 335 forks source link

Wrong every N-month calculate #173

Closed paulzi closed 4 years ago

paulzi commented 4 years ago
$cron = CronExpression::factory('35 4 1 */3 *');
echo $cron->getNextRunDate('2019-08-02 00:00:00')->format('Y-m-d H:i:s');

CRON run this expression at 2019-10-01 04:35:00, but getNextRunDate() return 2019-09-01 04:35:00.

dragonmantank commented 4 years ago

Hello there!

This package is no longer maintained, and has been moved over to https://github.com/dragonmantank/cron-expression.

That being said, this is an issue with the v1.x branch of the library, and has been fixed in v2.x and later. The issue was how we determined the offsets being used, and led to this issue. The fix for this was specifically part of the v2 release.

If you have any more problems, feel free to open an issue over at https://github.com/dragonmantank/cron-expression.