UNPKG

ember-hifi

Version:

The easy way to play audio in your ember app.

22 lines (15 loc) 541 B
import { helper } from '@ember/component/helper'; export function numericDuration([duration]) { var seconds = parseInt((duration / 1000) % 60), minutes = parseInt((duration / (1000 * 60)) % 60), hours = parseInt((duration / (1000 * 60 * 60)) % 24); minutes = (minutes < 10) ? "0" + minutes : minutes; seconds = (seconds < 10) ? "0" + seconds : seconds; if (hours > 0) { return hours + ":" + minutes + ":" + seconds; } else { return minutes + ":" + seconds; } } export default helper(numericDuration);