Skip to content

Fixing calculation of getFireTimeAfter in CalendarIntervalTriggerImpl - #1438

Open
okokhanyy wants to merge 8 commits into
quartz-scheduler:mainfrom
kkalin68:calendar_interval_trigger_fixes
Open

Fixing calculation of getFireTimeAfter in CalendarIntervalTriggerImpl#1438
okokhanyy wants to merge 8 commits into
quartz-scheduler:mainfrom
kkalin68:calendar_interval_trigger_fixes

Conversation

@okokhanyy

@okokhanyy okokhanyy commented Dec 12, 2025

Copy link
Copy Markdown

This PR addresses the following shortcomings with CalendarIntervalTriggerImpl.getFireTimeAfter(...):

  • monthly trigger's firings starting on 31 day of month get shifted to 30th day and eventually to 28th day
  • yearly trigger's firings starting on leap day of Feb 29 get shifted to 28th day of Feb
  • daily trigger falling within gap daylight savings transition shifts forward by one hour following the transition

Fix #1352
Fix #1444

Changes

  • refactored CalendarIntervalTriggerImpl.getFireTimeAfter to use LocalDateTime arithmetic
  • calculating next fire time relative to trigger's startTime rather than previous fire time, that addresses issues listed above
  • added unit tests for the use cases that are being addresses

Checklist

  • tested locally
  • updated the docs - NA
  • added appropriate test
  • signed-off on the DCO referenced in the CONTRIBUTING link below via git commit -s on my commits, and submit this code under terms of the Apache 2.0 license and assign copyright to the Quartz project owners
    (If you're not using command-line, you can use a browser extension )

In submitting this contribution, I agree to the terms of contributing as referred to here:
https://github.com/quartz-scheduler/contributing/blob/main/CONTRIBUTING.md

@okokhanyy
okokhanyy marked this pull request as draft December 13, 2025 04:39
@okokhanyy
okokhanyy force-pushed the calendar_interval_trigger_fixes branch from 35fd691 to bf17079 Compare December 13, 2025 05:59
@okokhanyy
okokhanyy marked this pull request as ready for review December 13, 2025 06:18
@okokhanyy
okokhanyy marked this pull request as draft December 13, 2025 06:19
@okokhanyy
okokhanyy force-pushed the calendar_interval_trigger_fixes branch from 32431b5 to 89c716d Compare December 15, 2025 22:00
@okokhanyy
okokhanyy marked this pull request as ready for review December 15, 2025 22:08
@okokhanyy
okokhanyy marked this pull request as draft December 16, 2025 19:18
@okokhanyy
okokhanyy marked this pull request as draft December 16, 2025 19:18
Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
…ateTime arithmetic

Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
@okokhanyy
okokhanyy force-pushed the calendar_interval_trigger_fixes branch from bd5cfd5 to b4b53e3 Compare January 15, 2026 06:07
Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
@okokhanyy
okokhanyy marked this pull request as ready for review January 20, 2026 18:29
Signed-off-by: Oleksiy Kokhanyy <oleksiy.kokhanyy@socotra.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants