mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 03:57:09 +03:00
Fixed getFormattedTime sometimes returning (NaN:NaN) (#643)
* Fixed getFormattedTime sometimes returning (NaN:NaN) getFormattedTime() with nothing passed into it and a couple other edge cases returned (NaN:NaN). This is a problem since on a slow machine getFormattedTime get called without anything passed into it around the time the computer is fetching the timing data. I haven't found the exact spot / place it is called wrongly, but this should fix it. I've have a slow machine so it's really been bugging me seeing (NaN:NaN) for a couple seconds before the page fully loads. Hopefully this should fix it.
This commit is contained in:
@@ -376,6 +376,9 @@ class Utils {
|
||||
//add a zero
|
||||
minutesDisplay = "0" + minutesDisplay;
|
||||
}
|
||||
if (isNaN(hours) || isNaN(minutes)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const formatted = (hours ? hours + ":" : "") + minutesDisplay + ":" + secondsDisplay;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user