Add formatSeconds()

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-08-27 16:19:59 +02:00
parent 470bc0ffe7
commit 342f51ccb0
No known key found for this signature in database
GPG Key ID: 55C211A1226CB17D
1 changed files with 12 additions and 0 deletions

View File

@ -136,6 +136,18 @@ export function formatCallTime(delta: Date): string {
return output;
}
export function formatSeconds(inSeconds: number): string {
const hours = Math.floor(inSeconds / (60 * 60)).toFixed(0).padStart(2, '0');
const minutes = Math.floor((inSeconds % (60 * 60)) / 60).toFixed(0).padStart(2, '0');
const seconds = Math.floor(((inSeconds % (60 * 60)) % 60)).toFixed(0).padStart(2, '0');
let output = "";
if (hours !== "00") output += `${hours}:`;
output += `${minutes}:${seconds}`;
return output;
}
const MILLIS_IN_DAY = 86400000;
export function wantsDateSeparator(prevEventDate: Date, nextEventDate: Date): boolean {
if (!nextEventDate || !prevEventDate) {