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

CronExpression fails to calculate next execution on the day of daylight saving time #28038

Closed
guilroux opened this issue Feb 11, 2022 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@guilroux
Copy link

guilroux commented Feb 11, 2022

Affects: Spring Framework 5.3.15

Looks like the fix for #26744 doesn't cover the following case.

Problem: CronExpression fails to calculate properly next execution when running on the day of daylight saving time, just before DST is applied.

ZonedDateTime current = ZonedDateTime.of(LocalDateTime.parse("2021-03-28T01:00:00"), ZoneId.of("Europe/Amsterdam"));
CronExpression cronExpression = CronExpression.parse("0 5 0 * * *");
ZonedDateTime next = cronExpression.next(current);

In this case the value returned by cronExpression.next(current) is 2021-03-30T00:05 instead of the expected 2021-03-29T00:05.

To be more precise any input date between 2021-03-28T00:05+01:00 and 2021-03-28T01:59+01:00 will calculate next execution to 2021-03-30T00:05 instead of the expected 2021-03-29T00:05.

After DST, next execution is successfully calculated i.e. 2021-03-29T00:05.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 11, 2022
@sbrannen sbrannen changed the title CronExpression fail to calculate next execution on the day of daylight saving time CronExpression fails to calculate next execution on the day of daylight saving time Feb 11, 2022
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Feb 11, 2022
@sbrannen sbrannen added this to the Triage Queue milestone Feb 11, 2022
vikeychen added a commit to vikeychen/spring-framework that referenced this issue Feb 12, 2022
This commit fixes an issue with CronExpression fails to calculate next execution on the day of daylight saving time.

Closes spring-projectsgh-28038
@poutsma poutsma self-assigned this Feb 16, 2022
@poutsma poutsma modified the milestones: Triage Queue, 5.3.16 Feb 16, 2022
@poutsma poutsma added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 16, 2022
poutsma added a commit that referenced this issue Feb 16, 2022
@poutsma
Copy link
Contributor

poutsma commented Feb 16, 2022

Thanks for the PR, @vikeychen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants