diff options
author | Ajay Ramachandran <[email protected]> | 2020-07-18 22:23:46 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-18 22:23:46 -0400 |
commit | bf55b0f233afb34bf18495b87e191261a083cb08 (patch) | |
tree | 5b9deeb4f16cc596acb8722400de330e19a6668e | |
parent | 29e6ebab29d461be2c497fd974b25779d933c997 (diff) | |
parent | df1d3b401c53228d4fba97455622597d2f4f140a (diff) | |
download | SponsorBlock-2.0.4.2.tar.gz SponsorBlock-2.0.4.2.zip |
Merge pull request #415 from ajayyy/react2.0.4.2
Fixed minutes not displaying zero when hours are displayed
-rw-r--r-- | manifest/manifest.json | 2 | ||||
-rw-r--r-- | src/utils.ts | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/manifest/manifest.json b/manifest/manifest.json index ee6e5c35..b15524c7 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "SponsorBlock", - "version": "2.0.4.1", + "version": "2.0.4.2", "default_locale": "en", "description": "__MSG_Description__", "content_scripts": [{ diff --git a/src/utils.ts b/src/utils.ts index 53e4d694..43cdc68e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -334,6 +334,7 @@ class Utils { getFormattedTime(seconds: number, precise?: boolean): string { let hours = Math.floor(seconds / 60 / 60); let minutes = Math.floor(seconds / 60) % 60; + let minutesDisplay = String(minutes); let secondsNum = seconds % 60; if (!precise) { secondsNum = Math.floor(secondsNum); @@ -345,8 +346,12 @@ class Utils { //add a zero secondsDisplay = "0" + secondsDisplay; } + if (hours && minutes < 10) { + //add a zero + minutesDisplay = "0" + minutesDisplay; + } - let formatted = (hours ? hours + ":" : "") + minutes + ":" + secondsDisplay; + let formatted = (hours ? hours + ":" : "") + minutesDisplay + ":" + secondsDisplay; return formatted; } |