mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 12:37:05 +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:
@@ -1646,6 +1646,8 @@ function showTimeWithoutSkips(skippedDuration: number): void {
|
||||
|
||||
display.appendChild(duration);
|
||||
}
|
||||
|
||||
const durationAfterSkips = utils.getFormattedTime(video.duration - skippedDuration)
|
||||
|
||||
duration.innerText = skippedDuration <= 0 ? "" : " (" + utils.getFormattedTime(video.duration - skippedDuration) + ")";
|
||||
duration.innerText = (durationAfterSkips == null || skippedDuration <= 0) ? "" : " (" + durationAfterSkips + ")";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user