mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 06:57:09 +03:00
Format minutes from hours, and minutes to days, hours, and minutes
This commit is contained in:
@@ -739,8 +739,9 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
*/
|
*/
|
||||||
function getFormattedHours(minutes) {
|
function getFormattedHours(minutes) {
|
||||||
minutes = Math.round(minutes * 10) / 10
|
minutes = Math.round(minutes * 10) / 10
|
||||||
const hours = Math.floor(minutes / 60);
|
const days = Math.floor(minutes / 3600)
|
||||||
return (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1);
|
const hours = Math.floor(minutes / 60) % 24;
|
||||||
|
return (days > 0 ? days + "d " : "") + (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//end of function
|
//end of function
|
||||||
|
|||||||
Reference in New Issue
Block a user