mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2026-03-15 15:02:52 +03:00
15 lines
409 B
TypeScript
15 lines
409 B
TypeScript
/**
|
|
* Converts time in seconds to minutes:seconds
|
|
*/
|
|
export function getFormattedTime(totalSeconds: number): string {
|
|
const minutes = Math.floor(totalSeconds / 60);
|
|
const seconds = totalSeconds - minutes * 60;
|
|
let secondsDisplay = seconds.toFixed(3);
|
|
if (seconds < 10) {
|
|
//add a zero
|
|
secondsDisplay = `0${secondsDisplay}`;
|
|
}
|
|
|
|
return `${minutes}:${secondsDisplay}`;
|
|
}
|