diff options
author | Ajay Ramachandran <[email protected]> | 2021-12-15 22:01:31 -0500 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2021-12-15 22:01:31 -0500 |
commit | d42862541b1ce8c3fb306ce103d6fd42c961917d (patch) | |
tree | f333ece49aeb27d137d6b98a846e500e2727ab80 | |
parent | 54001763a78ec17a060161417293c6accfb66fe0 (diff) | |
parent | 7186829bc3072080fecf8b144ee391a54b0fe2e1 (diff) | |
download | SponsorBlock-d42862541b1ce8c3fb306ce103d6fd42c961917d.tar.gz SponsorBlock-d42862541b1ce8c3fb306ce103d6fd42c961917d.zip |
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock
-rw-r--r-- | public/_locales/en/messages.json | 8 | ||||
-rw-r--r-- | src/popup.ts | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index f4285495..c56b3275 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -837,5 +837,13 @@ }, "fillerNewFeature": { "message": "New! Skip tangents and jokes with the filler category. Enable in options" + }, + "dayAbbreviation": { + "message": "d", + "description": "100d" + }, + "hourAbbreviation": { + "message": "h", + "description": "100h" } } diff --git a/src/popup.ts b/src/popup.ts index bca6286d..84607e15 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -731,16 +731,17 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { } /** - * Converts time in minutes to 5h 25.1 + * Converts time in minutes to 2d 5h 25.1 * If less than 1 hour, just returns minutes * * @param {float} minutes * @returns {string} */ function getFormattedHours(minutes) { - minutes = Math.round(minutes * 10) / 10 - const hours = Math.floor(minutes / 60); - return (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1); + minutes = Math.round(minutes * 10) / 10; + const days = Math.floor(minutes / 3600); + const hours = Math.floor(minutes / 60) % 24; + return (days > 0 ? days + chrome.i18n.getMessage("dayAbbreviation") + " " : "") + (hours > 0 ? hours + chrome.i18n.getMessage("hourAbbreviation") + " " : "") + (minutes % 60).toFixed(1); } //end of function |