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

JodaTime throws exception on hour shifting #19

Closed
danilo-valente opened this issue May 20, 2015 · 6 comments
Closed

JodaTime throws exception on hour shifting #19

danilo-valente opened this issue May 20, 2015 · 6 comments

Comments

@danilo-valente
Copy link
Contributor

This code:

CronDefinition definition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);
CronParser parser = new CronParser(definition);
Cron cron = parser.parse("0/1 * * 1/1 * ? *");  // Every 1 second
ExecutionTime executionTime = ExecutionTime.forCron(cron);

DateTime now = new DateTime().withTime(23, 59, 59, 0);
DateTime nextExecution = executionTime.nextExecution(now);

Would throw this exception: org.joda.time.IllegalFieldValueException: Value 24 for hourOfDay must be in the range [0,23] because 23:59:59 + 1 second would become 24:00:00, which is an invalid hour for a new DateTime object.

@jmrozanec
Copy link
Owner

@danilo-valente Good catch! Thank you for contributing the fix!

jmrozanec added a commit that referenced this issue May 20, 2015
Issue #19: Fix nextExecution/lastExecution datetime shifting
@jmrozanec jmrozanec added the done label May 21, 2015
@danilo-valente
Copy link
Contributor Author

@jmrozanec Glad to help! Do you have any idea on when v1.1.3 is going to be released?

@jmrozanec
Copy link
Owner

@danilo-valente I will be releasing it this weekend.

@danilo-valente
Copy link
Contributor Author

@jmrozanec Thanks 😃

@jmrozanec
Copy link
Owner

@danilo-valente you are welcome!

@jmrozanec
Copy link
Owner

@danilo-valente new version released! New version number is 2.0.0, since there were some incompatible API changes.

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