aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorLucas Declercq <lucas-dclrcq@users.noreply.github.com>2018-03-19 10:32:12 +0100
committerChocobozzz <me@florianbigard.com>2018-03-19 10:32:12 +0100
commitf6aec1b0f64b18a767b458286e0d6a5f6549a573 (patch)
treefcb195e24038915e20703ebed936a94b84c2af0d /client/src
parent2db6f2b0c16d5bc56528f2d6d57a270661218d97 (diff)
downloadPeerTube-f6aec1b0f64b18a767b458286e0d6a5f6549a573.tar.gz
PeerTube-f6aec1b0f64b18a767b458286e0d6a5f6549a573.tar.zst
PeerTube-f6aec1b0f64b18a767b458286e0d6a5f6549a573.zip
Update video duration string to show hours when duration greater than or equal 60min (#360)
* Update video duration string to show hours when >= 60min * Only show hours in duration when relevant * Fix problem with ternary expression * Remove accidentally commited package-lock.json
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/shared/video/video.model.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index 8e46ce44b..50ca9eb99 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -42,12 +42,16 @@ export class Video implements VideoServerModel {
42 } 42 }
43 43
44 private static createDurationString (duration: number) { 44 private static createDurationString (duration: number) {
45 const minutes = Math.floor(duration / 60) 45 const hours = Math.floor(duration / 3600)
46 const minutes = Math.floor(duration % 3600 / 60)
46 const seconds = duration % 60 47 const seconds = duration % 60
48
47 const minutesPadding = minutes >= 10 ? '' : '0' 49 const minutesPadding = minutes >= 10 ? '' : '0'
48 const secondsPadding = seconds >= 10 ? '' : '0' 50 const secondsPadding = seconds >= 10 ? '' : '0'
51 const displayedHours = hours > 0 ? hours.toString() + ':' : ''
49 52
50 return minutesPadding + minutes.toString() + ':' + secondsPadding + seconds.toString() 53 return displayedHours + minutesPadding +
54 minutes.toString() + ':' + secondsPadding + seconds.toString()
51 } 55 }
52 56
53 constructor (hash: VideoServerModel) { 57 constructor (hash: VideoServerModel) {