fix: wrong minute count in long videos

This commit is contained in:
Hellyson Rodrigo Parteka 2021-09-28 04:27:55 -03:00
parent fe1717788f
commit 58cc548739
No known key found for this signature in database
GPG key ID: 3055745CA21934C7

View file

@ -1,12 +1,13 @@
export const prettyTime = (seconds: number): string => {
const nSeconds = seconds % 60;
const nMinutes = Math.floor(seconds / 60);
let nMinutes = Math.floor(seconds / 60);
const nHours = Math.floor(nMinutes / 60);
let res = '';
if (nHours !== 0) {
res += `${Math.round(nHours).toString().padStart(2, '0')}:`;
nMinutes -= nHours * 60;
}
res += `${Math.round(nMinutes).toString().padStart(2, '0')}:${Math.round(nSeconds).toString().padStart(2, '0')}`;