Fix UI logical date timezone mismatch on DAG trigger#62024
Open
Arunodoy18 wants to merge 1 commit intoapache:mainfrom
Open
Fix UI logical date timezone mismatch on DAG trigger#62024Arunodoy18 wants to merge 1 commit intoapache:mainfrom
Arunodoy18 wants to merge 1 commit intoapache:mainfrom
Conversation
When triggering a DAG with the UI timezone set to non-UTC, the logical date received by the backend did not match the date selected in the UI. Root causes: - TriggerDAGForm initialized logicalDate with a naive format string (YYYY-MM-DD HH:mm:ss) which was ambiguous when parsed by Date() - DateTimeInput used space separator instead of 'T' required by datetime-local inputs Fix: - Use dayjs().toISOString() for unambiguous UTC datetime - Use YYYY-MM-DDTHH:mm:ss format for datetime-local display - Add frontend and backend tests for timezone correctness Fixes apache#61982
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.
Problem
When triggering a DAG from the UI while the UI timezone is set to a non-UTC timezone, the logical date received by the backend does not match the logical date selected in the UI.
This results in inconsistent DAG run scheduling and incorrect logical date assignment.
Root Cause
Two issues were identified in the frontend:
TriggerDAGForminitializedlogicalDateusing a naive datetime format (YYYY-MM-DD HH:mm:ss).This produced timezone-ambiguous parsing behaviour when interpreted by browser
Date()APIs.DateTimeInputused a space separator instead of theTseparator required bydatetime-localinputs, causing inconsistent browser parsing behaviour.Solution
dayjs().toISOString()to ensure logical date is serialized as an unambiguous UTC datetime.YYYY-MM-DDTHH:mm:ssformat fordatetime-localdisplay to comply with browser standards.Tests
Added tests to verify timezone correctness:
Impact
closes: #61982
Was generative AI tooling used to co-author this PR?
Generated-by: ChatGPT and GitHub Copilot following Airflow Gen-AI contribution guidelines