From b7330facb77abf28c911257b871a79864df1721f Mon Sep 17 00:00:00 2001 From: Gerben Date: Mon, 21 Oct 2019 21:09:05 +0530 Subject: [PATCH] Always include minutes in bookmark title. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g. 3-6 is not descriptive enough. Better to write 0:03–0:06. --- app/create-bookmarks/background.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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;