Skip to content

Commit d0d38ab

Browse files
committed
Fix rendering of mean times
Fixes #923. The "mean run time" and the "mean queue time" in the services table could show as timestamps instead of durations. This patch should fix that.
1 parent 9677832 commit d0d38ab

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/components/systems/partials/MeanQueueTimeCell.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
2-
import { useTranslation } from "react-i18next";
3-
import { renderValidDate } from "../../../utils/dateUtils";
42
import { Service } from "../../../slices/serviceSlice";
3+
import moment from "moment";
54

65
/**
76
* This component renders the mean queue time cells of systems in the table view
@@ -11,11 +10,10 @@ const MeanQueueTimeCell = ({
1110
}: {
1211
row: Service
1312
}) => {
14-
const { t } = useTranslation();
1513

1614
return (
1715
<span>
18-
{t("dateFormats.time.medium", { time: renderValidDate(row.meanQueueTime.toString()) })}
16+
{ moment.utc(moment.duration(row.meanQueueTime* 1000).asMilliseconds()).format("HH:mm:ss") }
1917
</span>
2018
);
2119
};

src/components/systems/partials/MeanRunTimeCell.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
2-
import { useTranslation } from "react-i18next";
3-
import { renderValidDate } from "../../../utils/dateUtils";
42
import { Service } from "../../../slices/serviceSlice";
3+
import moment from "moment";
54

65
/**
76
* This component renders the mean run time cells of systems in the table view
@@ -11,11 +10,10 @@ const MeanRunTimeCell = ({
1110
}: {
1211
row: Service
1312
}) => {
14-
const { t } = useTranslation();
1513

1614
return (
1715
<span>
18-
{t("dateFormats.time.medium", { time: renderValidDate(row.meanRunTime.toString()) })}
16+
{ moment.utc(moment.duration(row.meanRunTime * 1000).asMilliseconds()).format("HH:mm:ss") }
1917
</span>
2018
);
2119
};

0 commit comments

Comments
 (0)