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
This commit is contained in:
parent
2db6f2b0c1
commit
f6aec1b0f6
|
@ -42,12 +42,16 @@ export class Video implements VideoServerModel {
|
|||
}
|
||||
|
||||
private static createDurationString (duration: number) {
|
||||
const minutes = Math.floor(duration / 60)
|
||||
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 minutesPadding + minutes.toString() + ':' + secondsPadding + seconds.toString()
|
||||
return displayedHours + minutesPadding +
|
||||
minutes.toString() + ':' + secondsPadding + seconds.toString()
|
||||
}
|
||||
|
||||
constructor (hash: VideoServerModel) {
|
||||
|
|
Loading…
Reference in New Issue