Improve layout, add current time and duration

This commit is contained in:
Jorrin
2024-02-13 21:13:48 +01:00
parent 0a98e86de1
commit 378b16b3e4
7 changed files with 118 additions and 49 deletions

View File

@@ -0,0 +1,18 @@
export const mapMillisecondsToTime = (milliseconds: number): string => {
const hours = Math.floor(milliseconds / (1000 * 60 * 60));
const minutes = Math.floor((milliseconds % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((milliseconds % (1000 * 60)) / 1000);
const components: string[] = [];
if (hours > 0) {
components.push(hours.toString().padStart(2, "0"));
}
components.push(minutes.toString().padStart(2, "0"));
components.push(seconds.toString().padStart(2, "0"));
const formattedTime = components.join(":");
return formattedTime;
};