aboutsummaryrefslogtreecommitdiff
path: root/src/duration.ts
blob: 92952a718def52076c5328103b9b97a6a43cf885 (plain)
1
2
3
4
5
6
7
8
9
function prettyPrintNumber(n: number): string {
  return n.toString().padStart(2, "0")
}

export function prettyPrint(duration: number): string {
  const minutes = Math.floor(duration / 60)
  const seconds = duration % 60
  return prettyPrintNumber(minutes) + ":" + prettyPrintNumber(seconds)
}