clock element

This commit is contained in:
Jose B
2023-08-08 15:12:06 -05:00
parent 325209891d
commit 033bbaa347
2 changed files with 47 additions and 2 deletions

View File

@@ -17,3 +17,15 @@ export function Mulberry32(seed) {
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
export const formatTime = (seconds) => {
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;
};