diff options
author | Brian Choromanski <[email protected]> | 2021-12-04 11:56:55 -0500 |
---|---|---|
committer | Brian Choromanski <[email protected]> | 2021-12-04 11:56:55 -0500 |
commit | bc990cd683b169fd976774296f8a13df1361f746 (patch) | |
tree | 0d8ab7677b4592b610e5e50c7147caa1f9070981 | |
parent | 2f8ec7a5e5402a6e73fae3b2500930c9cc8d2ed5 (diff) | |
download | SponsorBlock-bc990cd683b169fd976774296f8a13df1361f746.tar.gz SponsorBlock-bc990cd683b169fd976774296f8a13df1361f746.zip |
Format minutes from hours, and minutes to days, hours, and minutes
-rw-r--r-- | src/popup.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/popup.ts b/src/popup.ts index 41bf1062..e11cb600 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -739,8 +739,9 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { */ function getFormattedHours(minutes) { minutes = Math.round(minutes * 10) / 10 - const hours = Math.floor(minutes / 60); - return (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1); + const days = Math.floor(minutes / 3600) + const hours = Math.floor(minutes / 60) % 24; + return (days > 0 ? days + "d " : "") + (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1); } //end of function |