Fix occasionally displaying times as 1:010

This commit is contained in:
Eevee (Evelyn Woods) 2020-12-29 10:15:57 -07:00
parent 6c99752f37
commit a32b29976e

View File

@ -183,7 +183,9 @@ export function b64decode(data) {
export function format_duration(seconds, places = 0) {
let mins = Math.floor(seconds / 60);
let secs = seconds % 60;
return `${mins}:${secs < 10 ? '0' : ''}${secs.toFixed(places)}`;
let rounded_secs = secs.toFixed(places);
// TODO hours?
return `${mins}:${parseFloat(rounded_secs) < 10 ? '0' : ''}${rounded_secs}`;
}
export class DelayTimer {