Fix Gantt view "Error invalid date" on running DagRun#64752
Draft
alamashir wants to merge 5 commits intoapache:mainfrom
Draft
Fix Gantt view "Error invalid date" on running DagRun#64752alamashir wants to merge 5 commits intoapache:mainfrom
alamashir wants to merge 5 commits intoapache:mainfrom
Conversation
834aa1d to
23de8f9
Compare
Contributor
Contributor
PR description doesn't match the actual diffThe description claims five changes, but the diff only modifies 4 lines in
The only actual changes in this PR are:
Could you update the description to accurately reflect what this PR changes? Also noting the inconsistent null handling between the two scale blocks — in the |
The Gantt chart scale calculation used new Date() to parse date strings, which fails for non-UTC timezone abbreviations, returning NaN and crashing Chart.js's time scale. Changes: - Replace new Date().getTime() with dayjs().valueOf() for reliable date parsing in the x-axis scale min/max calculations. - Add unit tests for Gantt chart scale calculations and data transformation covering completed tasks, running tasks with null end dates, groups with null dates, and ISO date string validity.
- Fix object property ordering in test data (alphabetical) - Import vi as type-only from vitest - Fix duration field position in selectedRun objects - Make dayjs null handling consistent between max and min scale calculations (remove unnecessary ?? undefined)
Update test fixtures to match current generated types: - Add has_missed_deadline to GridRunsResponse objects - Remove dag_id and map_index from GanttTaskInstance objects - Add depth to GridTask objects - Add task_display_name to LightGridTaskInstanceSummary objects
3e376da to
3069c03
Compare
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.

Summary
Fixes #64599
The Gantt chart's x-axis scale min/max calculation used
new Date().getTime()to parse date strings. SincetransformGanttDataoutputs ISO strings viadayjs().toISOString(), this worked in most cases, butnew Date()parsing is not guaranteed by the ECMAScript spec for all formats and can returnNaNin edge cases, crashing Chart.js's time scale with "Error invalid date".Changes
new Date(...).getTime()withdayjs(...).valueOf()in the x-axis scale min and max calculations for consistent, reliable date parsingcreateChartOptionsscale calculations (completed tasks, running tasks, empty data fallback) andtransformGanttData(null start_date filtering, running task end time, null group dates, ISO string validity)Test plan