alamashir opened a new pull request, #64752:
URL: https://github.com/apache/airflow/pull/64752

   ## Summary
   
   Fixes #64599
   
   The Gantt chart crashed with "Error invalid date" when viewing a running 
DagRun because:
   - Dates were formatted into display strings with timezone abbreviations 
(e.g. `"2024-01-01 12:00:00 CDT"`) and stored in the chart data array
   - The scale min/max calculation used `new Date()` to parse these back, which 
fails for non-UTC timezone abbreviations, returning `NaN` and crashing 
Chart.js's time scale
   - Tasks that hadn't started yet (null `start_date`) were given fake 
zero-width bars, feeding invalid data into the chart
   
   ### Changes
   - Store raw ISO date strings from the API in the data array instead of 
pre-formatted display strings — formatting now only happens at display time 
(tooltips, tick labels)
   - Replace `new Date().getTime()` with `dayjs().valueOf()` for reliable date 
parsing in scale min/max calculations
   - Skip tasks/groups where `start_date` is null (task hasn't started, no 
meaningful bar to show)
   - Handle running groups by using current time as end date when 
`max_end_date` is null
   - Add unit tests for Gantt chart scale calculations
   
   ## Test plan
   - [x] All 63 existing UI tests pass
   - [x] 4 new unit tests added covering:
     - Completed tasks with ISO dates
     - Running tasks with null end dates (the main bug scenario)
     - Empty data with running DagRun (fallback branch)
     - Data containing null end dates does not produce NaN
   - [ ] Manual verification: trigger a DAG run, open grid view, enable "Show 
Gantt" while the run is still in progress — should render without error
   - [ ] Manual verification: Gantt chart for completed DagRuns still works 
correctly
   - [ ] Manual verification: tooltip shows correct start/end dates and duration


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to