diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-27 15:59:00 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:04:06 +0200 |
commit | 11b8762f9c815930982599f4ff90c0db60eaf0ca (patch) | |
tree | bfca3003c619559284e00fe804d080e66c3ede12 /client/src/app/shared/misc | |
parent | c9d5c64f98c1f1fe7950de60c58edeaf3ace070d (diff) | |
download | PeerTube-11b8762f9c815930982599f4ff90c0db60eaf0ca.tar.gz PeerTube-11b8762f9c815930982599f4ff90c0db60eaf0ca.tar.zst PeerTube-11b8762f9c815930982599f4ff90c0db60eaf0ca.zip |
Add start at checkbox in share modal
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r-- | client/src/app/shared/misc/utils.ts | 13 |
1 files changed, 13 insertions, 0 deletions
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) { | |||
51 | return datePipe.transform(date, 'medium') | 51 | return datePipe.transform(date, 'medium') |
52 | } | 52 | } |
53 | 53 | ||
54 | function durationToString (duration: number) { | ||
55 | const hours = Math.floor(duration / 3600) | ||
56 | const minutes = Math.floor((duration % 3600) / 60) | ||
57 | const seconds = duration % 60 | ||
58 | |||
59 | const minutesPadding = minutes >= 10 ? '' : '0' | ||
60 | const secondsPadding = seconds >= 10 ? '' : '0' | ||
61 | const displayedHours = hours > 0 ? hours.toString() + ':' : '' | ||
62 | |||
63 | return displayedHours + minutesPadding + minutes.toString() + ':' + secondsPadding + seconds.toString() | ||
64 | } | ||
65 | |||
54 | function immutableAssign <A, B> (target: A, source: B) { | 66 | function immutableAssign <A, B> (target: A, source: B) { |
55 | return Object.assign({}, target, source) | 67 | return Object.assign({}, target, source) |
56 | } | 68 | } |
@@ -114,6 +126,7 @@ function sortBy (obj: any[], key1: string, key2?: string) { | |||
114 | 126 | ||
115 | export { | 127 | export { |
116 | sortBy, | 128 | sortBy, |
129 | durationToString, | ||
117 | objectToUrlEncoded, | 130 | objectToUrlEncoded, |
118 | getParameterByName, | 131 | getParameterByName, |
119 | populateAsyncUserVideoChannels, | 132 | populateAsyncUserVideoChannels, |