|
|
|
|
@ -19,12 +19,15 @@ const getAccumulatedSeconds = (newerTime, olderTime) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const formatSeconds = (total, includeHours = false) => {
|
|
|
|
|
const timeObj = createTimeObj(total)
|
|
|
|
|
const timeObj = createTimeObj(Math.abs(total))
|
|
|
|
|
let result = (total < 0) ? '-' : ''
|
|
|
|
|
if(includeHours) {
|
|
|
|
|
return `${timeObj.hours}:${timeObj.minutes.toString().padStart(2,'0')}:${timeObj.seconds.toString().padStart(2,'0')}`;
|
|
|
|
|
result += `${timeObj.hours}:${timeObj.minutes.toString().padStart(2,'0')}`
|
|
|
|
|
} else {
|
|
|
|
|
return `${timeObj.hours*60 + timeObj.minutes}:${timeObj.seconds.toString().padStart(2,'0')}`;
|
|
|
|
|
result += `${timeObj.hours*60 + timeObj.minutes}`
|
|
|
|
|
}
|
|
|
|
|
result += `:${timeObj.seconds.toString().padStart(2,'0')}`
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { getHours, getMinutes, createTimeObj, getAccumulatedSeconds, formatSeconds }
|
|
|
|
|
|