diff --git a/app/create-bookmarks/background.js b/app/create-bookmarks/background.js index 094fc25..27f3785 100644 --- a/app/create-bookmarks/background.js +++ b/app/create-bookmarks/background.js @@ -1,16 +1,14 @@ import { makeRemotelyCallable } from 'webextension-rpc'; -// Format time as S, or M:SS, or H:MM:SS, depending on which would be needed to express maxSeconds. -// E.g. secondsToString(12) === '12', but secondsToString(12, 3600) === '0:00:12'. +// Format time as M:SS, or H:MM:SS, depending on which would be needed to express maxSeconds. +// E.g. secondsToString(12) === '0:12', but secondsToString(12, 3600) === '0:00:12'. function secondsToString(seconds, maxSeconds) { let s = `${Math.round(seconds % 60)}`; let m = ''; let h = ''; const minutes = Math.floor(seconds / 60); - if (minutes || maxSeconds >= 60) { - m = `${minutes % 60}:`; - if (!/^\d\d/.test(s)) s = '0' + s; - } + m = `${minutes % 60}:`; + if (!/^\d\d/.test(s)) s = '0' + s; if (seconds >= 60 * 60 || maxSeconds >= 60 * 60) { h = `${Math.floor(minutes / 60)}:`; if (m.length <= 2) m = '0' + m;