Fix Calendar view computing cron planned runs in UTC instead of the Dag's timezone - #71243
Open
simon-hoon wants to merge 2 commits into
Open
Fix Calendar view computing cron planned runs in UTC instead of the Dag's timezone#71243simon-hoon wants to merge 2 commits into
simon-hoon wants to merge 2 commits into
Conversation
CalendarService._calculate_cron_planned_runs() handed croniter a UTC-tagged start_time, so cron fields were matched against UTC wall-clock instead of the timetable's configured timezone. Localize start_time first, like CronMixin._get_next does, and convert results back to UTC. Closes apache#71234
simon-hoon
requested review from
bugraoz93,
choo121600,
ephraimbuddy,
henry3260,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
August 6, 2026 14:57
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #71234
CalendarService._calculate_cron_planned_runs()handedcronitera UTC-taggedstart_timewhen computing "planned" (future, not-yet-executed) calendar cells for cron-based timetables.cronitermatches cron fields against whatever wall-clock itsstart_timecarries, so for a Dag on a non-UTCdefault_timezone, planned runs came out shifted by the UTC offset (e.g. a08:00 Asia/Seoulschedule showed planned cells at17:00).This localizes
start_timeinto the timetable's own timezone before constructingcroniter, converting results back to UTC — same math as the common branch ofCronMixin._get_next. Its_covers_every_hourDST fold-hour workaround is intentionally not replicated, so every-hour crons in a DST timezone can undercount the folded hour's cell by one run, once a year. Historical (already-executed) runs were unaffected, since those come straight from already-correctDagRunrows.Added a regression test for a non-UTC cron timetable in
test_calendar.py.Verified with
uv sync --package apache-airflow-core+ pytest ontest_calendar.py: 20/20 passing (19 existing + 1 new).Before/after (local demo,


schedule="0 8 * * *",AIRFLOW__CORE__DEFAULT_TIMEZONE=Asia/Seoul): planned cells moved from the 16:00–17:00 row to the 08:00 row, now matching the Success row above.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.