Skip to content

Commit 1bdc39d

Browse files
[v3-1-test] Update duration format to show milliseconds (#56775) (#56961)
(cherry picked from commit 9366ab2) Co-authored-by: Brent Bovenzi <[email protected]>
1 parent 654ccd6 commit 1bdc39d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import { describe, it, expect } from "vitest";
2121
import { getDuration, renderDuration } from "./datetimeUtils";
2222

2323
describe("getDuration", () => {
24-
it("handles durations less than 10 seconds", () => {
24+
it("handles durations less than 60 seconds", () => {
2525
const start = "2024-03-14T10:00:00.000Z";
26-
const end = "2024-03-14T10:00:05.500Z";
26+
const end = "2024-03-14T10:00:05.5111111Z";
2727

28-
expect(getDuration(start, end)).toBe("5.50s");
28+
expect(getDuration(start, end)).toBe("00:00:05.511");
2929
});
3030

3131
it("handles durations spanning multiple days", () => {

airflow-core/src/airflow/ui/src/utils/datetimeUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export const renderDuration = (durationSeconds: number | null | undefined): stri
3131
return undefined;
3232
}
3333

34-
// If under 10 seconds, render as 9s
35-
if (durationSeconds < 10) {
36-
return `${durationSeconds.toFixed(2)}s`;
34+
// If under 60 seconds, render milliseconds
35+
if (durationSeconds < 60) {
36+
return dayjs.duration(Number(durationSeconds.toFixed(3)), "seconds").format("HH:mm:ss.SSS");
3737
}
3838

3939
// If under 1 day, render as HH:mm:ss otherwise include the number of days

0 commit comments

Comments
 (0)