How to use the duration.short.hours function in duration

To help you get started, we’ve selected a few duration examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microfocus-idol / find / find-web / src / main / webapp / static / bower_components / hp-autonomy-js-whatever / src / js / duration-format.js View on Github external
var durationFormat = function(ms, strings, precision) {
        var oneDay = strings ? ' ' + strings['duration.day'] : ' day';
        var days = strings ? ' ' + strings['duration.days'] : ' days';
        var oneHour = strings ? ' ' + strings['duration.short.hour'] : ' hour';
        var hours = strings ? ' ' + strings['duration.short.hours'] : ' hours';
        var oneMinute = strings ? ' ' + strings['duration.short.minute'] : ' min';
        var minutes = strings ? ' ' + strings['duration.short.minutes'] : ' mins';
        var seconds = strings ? strings['duration.short.seconds'] : 's';
        var milliseconds = strings ? strings['duration.short.millisecs'] : 'ms';

        var round;

        if (_.isUndefined(precision) || _.isNull(precision)) {
            precision = 1;
        }

        if (!isFinite(ms)) {
            return ms === Infinity ? '\u221e' : ms === -Infinity ? '-\u221e' : String(ms);
        }

        var magnitude = Math.abs(ms);