Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weekday crontab not working correctly. #19

Closed
kkirby opened this issue Sep 4, 2012 · 1 comment
Closed

Weekday crontab not working correctly. #19

kkirby opened this issue Sep 4, 2012 · 1 comment

Comments

@kkirby
Copy link
Contributor

kkirby commented Sep 4, 2012

First off, awesome library. Thanks for all the hard work.

I'm having an issue with the @Weekly cron tab (using both the alias and the actual cron tab of 0 0 * * 0). The issue is that it works fine for looking ahead, but not so much on looking behind.

If I do 0 0 * * 0 for now, the next date is at 2012-09-09 00:00:00, however the previous due date is 2012-03-11 00:00:00. I did some looking in the code and found that if I modify the following file:

DayOfWeekField, line 118 to: $date->setTime(0, 0, 0);

It works fine.

I'm not sure if this is actually the fix or not, or if something is weird with my machine. I ran PHPUnit on the tests (without my modification) and it came back with several errors and fails. Here is a paste bin of the test output: http://pastebin.com/s0MGpBid

Thanks!

@kkirby
Copy link
Contributor Author

kkirby commented Sep 4, 2012

My apologies. Apparently this is an issue with the version of PHP I am running. You can find more details on the bug here: https://bugs.php.net/bug.php?id=51090

I was able to pass the unit tests by adding this code:

$datetime->sub(new DateInterval("P0D"));

Right after any add or sub method call to a date inside of any increment method. So if "sub" was called inside of increment, I added the above code after the "sub" call. Same goes for any "add" call.

Thanks.

@kkirby kkirby closed this as completed Sep 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant