Compare commits

...

3 Commits

Author SHA1 Message Date
Ajay Ramachandran
bf55b0f233 Merge pull request #415 from ajayyy/react
Fixed minutes not displaying zero when hours are displayed
2020-07-18 22:23:46 -04:00
Ajay Ramachandran
df1d3b401c Update version number 2020-07-18 22:19:47 -04:00
Ajay Ramachandran
4d55a71619 Fixed minutes not displaying zero when hours are displayed 2020-07-18 22:19:13 -04:00
2 changed files with 7 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "__MSG_fullName__",
"short_name": "SponsorBlock",
"version": "2.0.4.1",
"version": "2.0.4.2",
"default_locale": "en",
"description": "__MSG_Description__",
"content_scripts": [{

View File

@@ -334,6 +334,7 @@ class Utils {
getFormattedTime(seconds: number, precise?: boolean): string {
let hours = Math.floor(seconds / 60 / 60);
let minutes = Math.floor(seconds / 60) % 60;
let minutesDisplay = String(minutes);
let secondsNum = seconds % 60;
if (!precise) {
secondsNum = Math.floor(secondsNum);
@@ -345,8 +346,12 @@ class Utils {
//add a zero
secondsDisplay = "0" + secondsDisplay;
}
if (hours && minutes < 10) {
//add a zero
minutesDisplay = "0" + minutesDisplay;
}
let formatted = (hours ? hours + ":" : "") + minutes + ":" + secondsDisplay;
let formatted = (hours ? hours + ":" : "") + minutesDisplay + ":" + secondsDisplay;
return formatted;
}