File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
peridot/ui/src/components Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,17 @@ import {
4848 translateTaskTypeToText ,
4949} from './ProjectTasks' ;
5050
51+
52+ function formatDuration ( ms ) {
53+ const seconds = Math . floor ( ( ms / 1000 ) % 60 ) ;
54+ const minutes = Math . floor ( ( ms / ( 1000 * 60 ) ) % 60 ) ;
55+ const hours = Math . floor ( ( ms / ( 1000 * 60 * 60 ) ) % 24 ) ;
56+
57+ return [ hours , minutes , seconds ]
58+ . map ( val => ( val < 10 ? `0${ val } ` : val ) ) // Adding leading zeros if necessary
59+ . join ( ':' ) ;
60+ }
61+
5162export interface ProjectTasksSubtasksProps {
5263 subtasks : V1Subtask [ ] ;
5364}
@@ -79,7 +90,7 @@ export const ProjectTasksSubtasks = (props: ProjectTasksSubtasksProps) => {
7990 ( new Date ( subtask . finishedAt ) as any ) -
8091 ( new Date ( subtask . createdAt ) as any ) ;
8192 subtaskDuration = (
82- < > { new Date ( difference - 3600000 ) . toLocaleTimeString ( ) } </ >
93+ < > { formatDuration ( difference ) } </ >
8394 ) ;
8495 }
8596
You can’t perform that action at this time.
0 commit comments