mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-04-19 21:03:56 +02:00
Merge pull request #368 from Hellysonrp/fix-pretty-time
This commit is contained in:
commit
811c80d544
1 changed files with 2 additions and 1 deletions
|
@ -1,12 +1,13 @@
|
||||||
export const prettyTime = (seconds: number): string => {
|
export const prettyTime = (seconds: number): string => {
|
||||||
const nSeconds = seconds % 60;
|
const nSeconds = seconds % 60;
|
||||||
const nMinutes = Math.floor(seconds / 60);
|
let nMinutes = Math.floor(seconds / 60);
|
||||||
const nHours = Math.floor(nMinutes / 60);
|
const nHours = Math.floor(nMinutes / 60);
|
||||||
|
|
||||||
let res = '';
|
let res = '';
|
||||||
|
|
||||||
if (nHours !== 0) {
|
if (nHours !== 0) {
|
||||||
res += `${Math.round(nHours).toString().padStart(2, '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')}`;
|
res += `${Math.round(nMinutes).toString().padStart(2, '0')}:${Math.round(nSeconds).toString().padStart(2, '0')}`;
|
||||||
|
|
Loading…
Add table
Reference in a new issue