aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-05-16 18:43:54 -0400
committerGitHub <[email protected]>2021-05-16 18:43:54 -0400
commitdaa7a653c9f21f8e83d4043654985493a2705b6f (patch)
treec8f469c34e03096ed0c8308c2ef8a36714cc43c3
parentddf3f7c6ff55ece51a67d97e616bb97f03648bee (diff)
parent606b2fbee32e604dd2faa6c01c485aa4876347ad (diff)
downloadSponsorBlock-daa7a653c9f21f8e83d4043654985493a2705b6f.tar.gz
SponsorBlock-daa7a653c9f21f8e83d4043654985493a2705b6f.zip
Merge pull request #747 from wilkmaciej/fix_saved_time_rounding
fix wrong saved time rounding
-rw-r--r--src/popup.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/popup.ts b/src/popup.ts
index d13af4a0..c37d3d90 100644
--- a/src/popup.ts
+++ b/src/popup.ts
@@ -726,10 +726,11 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
* @param {float} seconds
* @returns {string}
*/
- function getFormattedHours(minues) {
- const hours = Math.floor(minues / 60);
- return (hours > 0 ? hours + "h " : "") + (minues % 60).toFixed(1);
- }
+ function getFormattedHours(minutes) {
+ minutes = Math.round(minutes * 10) / 10
+ const hours = Math.floor(minutes / 60);
+ return (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1);
+ }
//end of function
}