MCPcopy Create free account
hub / github.com/experdot/pointer / formatDuration

Function formatDuration

src/renderer/src/utils/taskDisplayHelpers.tsx:83–96  ·  view source on GitHub ↗
(startTime: number, endTime?: number)

Source from the content-addressed store, hash-verified

81}
82
83export const formatDuration = (startTime: number, endTime?: number): string => {
84 const duration = endTime ? endTime - startTime : Date.now() - startTime
85 const seconds = Math.floor(duration / 1000)
86 const minutes = Math.floor(seconds / 60)
87 const hours = Math.floor(minutes / 60)
88
89 if (hours > 0) {
90 return `${hours}小时${minutes % 60}分钟`
91 } else if (minutes > 0) {
92 return `${minutes}分钟${seconds % 60}秒`
93 } else {
94 return `${seconds}秒`
95 }
96}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected