Skip to content

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

Closed
@guilroux

Description

@guilroux

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.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions