aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrian Choromanski <[email protected]>2021-12-04 11:56:55 -0500
committerBrian Choromanski <[email protected]>2021-12-04 11:56:55 -0500
commitbc990cd683b169fd976774296f8a13df1361f746 (patch)
tree0d8ab7677b4592b610e5e50c7147caa1f9070981
parent2f8ec7a5e5402a6e73fae3b2500930c9cc8d2ed5 (diff)
downloadSponsorBlock-bc990cd683b169fd976774296f8a13df1361f746.tar.gz
SponsorBlock-bc990cd683b169fd976774296f8a13df1361f746.zip
Format minutes from hours, and minutes to days, hours, and minutes
-rw-r--r--src/popup.ts5
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