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

lastExecution and nextExecution do not work #41

Closed
kwalsh413 opened this issue Sep 18, 2015 · 3 comments
Closed

lastExecution and nextExecution do not work #41

kwalsh413 opened this issue Sep 18, 2015 · 3 comments
Milestone

Comments

@kwalsh413
Copy link

for everything other than a dayOfWeek value == 1, nextExecution and lastExecution do not return correct results. Example below should return a date of 9/23 while it returns 9/30. Similiarly other days return a week further then they should. Only 1 gives the correct value of 9/21. I tried with previous versions of this and although i get a different result, it is still wrong. with previous versions i always get the next day (9/19)

CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
CronParser parser = new CronParser(cronDefinition);
Cron myCron = parser.parse("0 3 * * 3");
DateTime now = DateTime.now();
ExecutionTime executionTime = ExecutionTime.forCron(myCron);
DateTime nextExecution = executionTime.nextExecution(now);

@jmrozanec
Copy link
Owner

@kwalsh413 thank you for reporting this. Will review this issue as part of the fix for #37 and #38
Contributions are welcome!

jmrozanec added a commit that referenced this issue Oct 15, 2015
@jmrozanec
Copy link
Owner

@kwalsh413 the issue was fixed! Will release a new version of cron-utils to Maven central before weekend.

@jmrozanec
Copy link
Owner

@kwalsh413 Version 3.1.1 was released including this fix!

@jmrozanec jmrozanec added this to the 3.1.1 milestone Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants