From 11b8762f9c815930982599f4ff90c0db60eaf0ca Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 27 Aug 2018 15:59:00 +0200 Subject: Add start at checkbox in share modal --- client/src/app/shared/misc/utils.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'client/src/app/shared/misc/utils.ts') diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts index 018271efe..c8b7ebc67 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/shared/misc/utils.ts @@ -51,6 +51,18 @@ function dateToHuman (date: string) { return datePipe.transform(date, 'medium') } +function durationToString (duration: number) { + const hours = Math.floor(duration / 3600) + const minutes = Math.floor((duration % 3600) / 60) + const seconds = duration % 60 + + const minutesPadding = minutes >= 10 ? '' : '0' + const secondsPadding = seconds >= 10 ? '' : '0' + const displayedHours = hours > 0 ? hours.toString() + ':' : '' + + return displayedHours + minutesPadding + minutes.toString() + ':' + secondsPadding + seconds.toString() +} + function immutableAssign (target: A, source: B) { return Object.assign({}, target, source) } @@ -114,6 +126,7 @@ function sortBy (obj: any[], key1: string, key2?: string) { export { sortBy, + durationToString, objectToUrlEncoded, getParameterByName, populateAsyncUserVideoChannels, -- cgit v1.2.3