poliander / cron

Parse and validate crontab expressions in PHP
https://github.com/poliander/cron
GNU General Public License v3.0
63 stars 10 forks source link

Date slip with getNext() #11

Closed ThomasPerraudin closed 2 years ago

ThomasPerraudin commented 2 years ago

Similar #9

$c = new \Cron('0 3 * * *', new \DateTimeZone('Europe/Paris'));
echo $c->getNext();

When run at 1649202901 //2022-04-06 01:55:01

Expected:

1649206800 //2022-04-06 03:00:00

Actual:

1649206800 //2022-04-06 03:00:00 OK


When run at 1649203201 //2022-04-06 02:00:01

Expected:

1649206800 //2022-04-06 03:00:00

Actual:

1649293200 //2022-04-07 03:00:00 ERROR

poliander commented 2 years ago

Thank you for reporting the bug and providing reproducible examples. It should finally be fixed in v2.4.2. Please consider also switching to v3.0.0 (note the namespace change).