This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 33c4ac2efbc48de24e8f8bb81d93721655811eb8
Author: Sean Yu <[email protected]>
AuthorDate: Wed Nov 19 03:04:25 2025 +0800

    make sure the taskInstances's endDate is not null (#58435)
    
    (cherry picked from commit 31a863680d2a7897255df000c55e1531b616aea9)
---
 airflow-core/src/airflow/ui/src/components/DurationChart.tsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/ui/src/components/DurationChart.tsx 
b/airflow-core/src/airflow/ui/src/components/DurationChart.tsx
index 5699dcc8c8d..c1dad57abc9 100644
--- a/airflow-core/src/airflow/ui/src/components/DurationChart.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DurationChart.tsx
@@ -57,7 +57,16 @@ const average = (ctx: PartialEventContext, index: number) => 
{
 
 type RunResponse = GridRunsResponse | TaskInstanceResponse;
 
-const getDuration = (start: string, end: string | null) => 
dayjs.duration(dayjs(end).diff(start)).asSeconds();
+const getDuration = (start: string, end: string | null) => {
+  const startDate = dayjs(start);
+  const endDate = end === null ? dayjs() : dayjs(end);
+
+  if (!startDate.isValid() || !endDate.isValid()) {
+    return 0;
+  }
+
+  return dayjs.duration(endDate.diff(startDate)).asSeconds();
+};
 
 export const DurationChart = ({
   entries,

Reply via email to