Skip to content

Commit 47d66a4

Browse files
authored
[dashboard] Fix duration displaying (no "undefinedh") (#20053)
1 parent 71ab59d commit 47d66a4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

components/dashboard/src/prebuilds/detail/PrebuildDetailPage.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,16 @@ export const PrebuildDetailPage: FC = () => {
130130
"milliseconds",
131131
);
132132

133-
if (duration.asMinutes() < 1) {
134-
return duration.format("s[s]");
133+
const s = duration.get("s");
134+
const m = duration.get("m");
135+
const h = duration.get("h");
136+
if (h >= 1) {
137+
return `${h}h ${m}m ${s}s`;
135138
}
136-
if (duration.asHours() < 1) {
137-
return duration.format("m[m] s[s]");
139+
if (m >= 1) {
140+
return `${m}m ${s}s`;
138141
}
139-
140-
return duration.format("h[h] m[m] s[s]");
142+
return `${s}s`;
141143
}, [prebuild?.status?.startTime, prebuild?.status?.stopTime]);
142144

143145
const setSelectedTaskId = useCallback(

0 commit comments

Comments
 (0)