Skip to content

Commit

Permalink
single digit hours
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster1 committed Oct 7, 2024
1 parent edd0c86 commit d031a31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('formatDurationLabeled', () => {
seconds: 2,
}

const expected = '02h 40m 02s'
const expected = '2h 40m 02s'

expect(formatDurationLabeled(duration)).toEqual(expected)
})
Expand All @@ -64,7 +64,7 @@ describe('formatDurationLabeled', () => {
seconds: 2,
}

const expected = '00h 00m 02s'
const expected = '0h 00m 02s'

expect(formatDurationLabeled(duration)).toEqual(expected)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function timestampDetails(
const normalizedMinutes = Math.floor((totalSeconds % 3600) / 60)
const normalizedSeconds = totalSeconds % 60

const paddedHours = padStart(normalizedHours.toString(), 2, '0')
const paddedHours = padStart(normalizedHours.toString(), 1, '0')
const paddedMinutes = padStart(normalizedMinutes.toString(), 2, '0')
const paddedSeconds = padStart(normalizedSeconds.toString(), 2, '0')
return { hours: paddedHours, minutes: paddedMinutes, seconds: paddedSeconds }
Expand Down

0 comments on commit d031a31

Please sign in to comment.