This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new 1bdc39d84c1 [v3-1-test] Update duration format to show milliseconds
(#56775) (#56961)
1bdc39d84c1 is described below
commit 1bdc39d84c106fb4cfb0cfb4927b76ac317faa73
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Oct 21 17:40:59 2025 +0100
[v3-1-test] Update duration format to show milliseconds (#56775) (#56961)
(cherry picked from commit 9366ab2f55936200d51faa89dabe7cca9fe98728)
Co-authored-by: Brent Bovenzi <[email protected]>
---
airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts | 6 +++---
airflow-core/src/airflow/ui/src/utils/datetimeUtils.ts | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts
b/airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts
index 229936d925f..2ec8c47fd09 100644
--- a/airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts
+++ b/airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts
@@ -21,11 +21,11 @@ import { describe, it, expect } from "vitest";
import { getDuration, renderDuration } from "./datetimeUtils";
describe("getDuration", () => {
- it("handles durations less than 10 seconds", () => {
+ it("handles durations less than 60 seconds", () => {
const start = "2024-03-14T10:00:00.000Z";
- const end = "2024-03-14T10:00:05.500Z";
+ const end = "2024-03-14T10:00:05.5111111Z";
- expect(getDuration(start, end)).toBe("5.50s");
+ expect(getDuration(start, end)).toBe("00:00:05.511");
});
it("handles durations spanning multiple days", () => {
diff --git a/airflow-core/src/airflow/ui/src/utils/datetimeUtils.ts
b/airflow-core/src/airflow/ui/src/utils/datetimeUtils.ts
index a5495111d69..abd598e3deb 100644
--- a/airflow-core/src/airflow/ui/src/utils/datetimeUtils.ts
+++ b/airflow-core/src/airflow/ui/src/utils/datetimeUtils.ts
@@ -31,9 +31,9 @@ export const renderDuration = (durationSeconds: number | null
| undefined): stri
return undefined;
}
- // If under 10 seconds, render as 9s
- if (durationSeconds < 10) {
- return `${durationSeconds.toFixed(2)}s`;
+ // If under 60 seconds, render milliseconds
+ if (durationSeconds < 60) {
+ return dayjs.duration(Number(durationSeconds.toFixed(3)),
"seconds").format("HH:mm:ss.SSS");
}
// If under 1 day, render as HH:mm:ss otherwise include the number of days