Skip to content

Commit

Permalink
Merge pull request #5 from mxfo/master
Browse files Browse the repository at this point in the history
Fixes #4 Duration without timezone
  • Loading branch information
mxfo committed Nov 4, 2022
2 parents 7e38aeb + d555f91 commit 2486fd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,9 @@ import { Link } from 'react-router-dom';
import extensions from '../../extensions/extensions';
import { fetchJsonRpc } from '../../service/fetchJsonRpc';
import './Execution.css';
import { ReportTable } from './ReportTable';
import {duration, ReportTable} from './ReportTable';
import { getStatusColor } from './status';


function toDuration(job) {
try {
const ms = new Date(Date.parse(job.finished) - Date.parse(job.started));
return [
`0${ms.getHours() - 1}`.slice(-2),
`0${ms.getMinutes()}`.slice(-2),
`0${ms.getSeconds()}`.slice(-2),
].join(':');
} catch (e) {
return "?";
}
}

function ExecutionBreadcrumb() {
const { id } = useParams();
return (
Expand Down Expand Up @@ -70,7 +56,7 @@ function Execution(props) {
</Descriptions.Item>
<Descriptions.Item label="Started">{data.started}</Descriptions.Item>
<Descriptions.Item label="Finished">{data.finished}</Descriptions.Item>
<Descriptions.Item label="Duration">{toDuration(data)}</Descriptions.Item>
<Descriptions.Item label="Duration">{duration(data)}</Descriptions.Item>
<Descriptions.Item label="Comment">{extensions.commentWrapper(data.comment)}</Descriptions.Item>
</Descriptions>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function reportColumns(idRenderer, previousId, showDuration) {
];
}

function duration({ started, finished }) {
export function duration({ started, finished }) {
if (!finished || !started) {
return '?';
}
Expand Down

0 comments on commit 2486fd4

Please sign in to comment.