Skip to content

Scheduling a task that runs once a day results in March 28 being skipped #26744

Closed
@AlexCovizzi

Description

@AlexCovizzi

Affects: Spring Framework 5.3.1


Problem: Scheduled task marked with the annotation @Scheduled(cron = ""0 0 9 * * *"", zone = "Europe/Amsterdam") did not run on March 28

Expected behaviour: The scheduled task should have run on March 28

How to reproduce: The bug seems to be related to the class CronExpression introduced in version 5.3

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

In this case the value returned by cronExpression.next() is 2021-03-29T09:00:00 instead of the expected 2021-03-28T09:00:00

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