mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 12:19:06 +00:00
12 lines
353 B
TypeScript
12 lines
353 B
TypeScript
export const formatTime = (seconds: number): string => {
|
|
let hours = Math.floor(seconds / 3600);
|
|
let minutes = Math.floor((seconds % 3600) / 60);
|
|
let secs = Math.floor(seconds % 60);
|
|
|
|
let timeString = `${hours > 0 ? hours + ":" : ""}${minutes
|
|
.toString()
|
|
.padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
|
|
|
return timeString;
|
|
};
|