This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 31a863680d2 make sure the taskInstances's endDate is not null (#58435)
31a863680d2 is described below
commit 31a863680d2a7897255df000c55e1531b616aea9
Author: Sean Yu <[email protected]>
AuthorDate: Wed Nov 19 03:04:25 2025 +0800
make sure the taskInstances's endDate is not null (#58435)
---
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 c0fd7cf796b..69e34779979 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,