Update duration to display in seconds instead of milliseconds
parent
db2b9e278e
commit
a5369fbab4
|
@ -469,7 +469,7 @@ export const getRuns = (taskID: string) => async (dispatch): Promise<void> => {
|
|||
|
||||
return {
|
||||
...run,
|
||||
duration: `${finished.getTime() - started.getTime()} seconds`,
|
||||
duration: `${runDuration(finished, started)}`,
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -535,3 +535,16 @@ export const createTaskFromTemplate = (template: ITaskTemplate) => async (
|
|||
dispatch(notify(importTaskFailed(error)))
|
||||
}
|
||||
}
|
||||
|
||||
export const runDuration = (finishedAt: Date, startedAt: Date): string => {
|
||||
let timeTag = 'seconds'
|
||||
|
||||
let diff = (finishedAt.getTime() - startedAt.getTime()) / 1000
|
||||
|
||||
if (diff > 60) {
|
||||
diff = Math.round(diff / 60)
|
||||
timeTag = 'minutes'
|
||||
}
|
||||
|
||||
return diff + ' ' + timeTag
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue