examples/phonegap1/plugins/cordova-plugin-globalization/www/firefoxos/l10n_date.js
function relativeParts (seconds) {
        seconds = Math.abs(seconds);
        var descriptors = {};
        var units = [
            'years', 86400 * 365,
            'months', 86400 * 30,
            'weeks', 86400 * 7,
            'days', 86400,
            'hours', 3600,
            'minutes', 60
        ];

        if (seconds < 60) {
            return {
                minutes: Math.round(seconds / 60)
            };
        }

        for (var i = 0, uLen = units.length; i < uLen; i += 2) {
            var value = units[i + 1];
            if (seconds >= value) {
                descriptors[units[i]] = Math.floor(seconds / value);
                seconds -= descriptors[units[i]] * value;
            }
        }
        return descriptors;
    }
function relativeParts (seconds) {
        seconds = Math.abs(seconds);
        var descriptors = {};
        var units = [
            'years', 86400 * 365,
            'months', 86400 * 30,
            'weeks', 86400 * 7,
            'days', 86400,
            'hours', 3600,
            'minutes', 60
        ];

        if (seconds < 60) {
            return {
                minutes: Math.round(seconds / 60)
            };
        }

        for (var i = 0, uLen = units.length; i < uLen; i += 2) {
            var value = units[i + 1];
            if (seconds >= value) {
                descriptors[units[i]] = Math.floor(seconds / value);
                seconds -= descriptors[units[i]] * value;
            }
        }
        return descriptors;
    }
function relativeParts ( seconds ) { seconds = Math . abs ( seconds ) ; var descriptors = { } ; var units = [ 'years' , 86400 * 365 , 'months' , 86400 * 30 , 'weeks' , 86400 * 7 , 'days' , 86400 , 'hours' , 3600 , 'minutes' , 60 ] ; if ( seconds < 60 ) { return { minutes : Math . round ( seconds / 60 ) } ; } for ( var i = 0 , uLen = units . length ; i < uLen ; i += 2 ) { var value = units [ i + 1 ] ; if ( seconds >= value ) { descriptors [ units [ i ] ] = Math . floor ( seconds / value ) ; seconds -= descriptors [ units [ i ] ] * value ; } } return descriptors ; }
Returns the parts of a number of seconds
Returns the parts of a number of seconds