Browse Source

update time control display

pull/121/head
Jelle van Snik 3 years ago
parent
commit
40cca10660
  1. 16
      src/components/video/controls/TimeControl.tsx

16
src/components/video/controls/TimeControl.tsx

@ -13,19 +13,17 @@ function formatSeconds(secs: number, showHours = false): string {
let time = secs; let time = secs;
const seconds = time % 60; const seconds = time % 60;
time /= 60; time = Math.floor(time / 60);
const minutes = time % 60; const minutes = time % 60;
time /= 60; time = Math.floor(time / 60);
const hours = time; const hours = time;
if (!showHours) const paddedSecs = seconds.toString().padStart(2, "0");
return `${Math.floor(minutes).toString()}:${Math.floor(seconds) const paddedMins = minutes.toString().padStart(2, "0");
.toString()
.padStart(2, "0")}`; if (!showHours) return [minutes, paddedSecs].join(":");
return `${Math.floor(hours).toString()}:${Math.floor(minutes) return [hours, paddedMins, paddedSecs].join(":");
.toString()
.padStart(2, "0")}:${Math.floor(seconds).toString().padStart(2, "0")}`;
} }
interface Props { interface Props {

Loading…
Cancel
Save