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:
Evan Gubarev
2021-02-07 10:09:01 -08:00
committed by GitHub
parent 7ecc1b9e41
commit 026858509a
2 changed files with 6 additions and 1 deletions

View File

@@ -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 + ")";
}