Podcast player components (#37)

This commit is contained in:
Ollie Taylor
2023-03-06 15:25:34 +00:00
committed by GitHub
parent 47aabda96d
commit 9232f4d52e
37 changed files with 1375 additions and 156 deletions
+2 -2
View File
@@ -3,14 +3,14 @@ function section(t: number) {
return t;
}
export function secondsToTimestamp(seconds: number) {
export function secondsToTimestamp(seconds: number, force_hours = false) {
const hh = Math.floor(seconds / 3600);
const hh_remainder = seconds % 3600;
const mm = Math.floor(hh_remainder / 60);
const mm_remainder = hh_remainder % 60;
const ss = Math.floor(mm_remainder);
const hrs = hh > 0 ? `${section(hh)}:` : '';
const hrs = force_hours || hh > 0 ? `${section(hh)}:` : '';
const mins = mm ? `${section(mm)}:` : '00:';
const secs = ss ? `${section(ss)}` : '00';