all files / javascript/ software.bytepushers.utils.DateUtility.js

53.33% Statements 8/15
30% Branches 3/10
66.67% Functions 2/3
53.33% Lines 8/15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                                             
/*global window, document, BytePushers*/
/*jslint unparam: true*/
(function (window, document, BytePushers) {
    'use strict';
    BytePushers = BytePushers || {};
    BytePushers.DateUtility = BytePushers.namespace("software.bytepushers.utils.DateUtility");
    BytePushers.DateUtility.date_sort_asc = function (date1, date2) {
        // This is a comparison function that will result in dates being sorted in
        // ASCENDING order. As you can see, JavaScript's native comparison operators
        // can be used to compare dates. This was news to me.
        Iif (date1 > date2) {
            return 1;
        }
        Eif (date1 < date2) {
            return -1;
        }
        return 0;
    };
    BytePushers.DateUtility.date_sort_desc = function (date1, date2) {
        // This is a comparison function that will result in dates being sorted in
        // DESCENDING order.
        if (date1 > date2) {
            return -1;
        }
        if (date1 < date2) {
            return 1;
        }
        return 0;
    };
}(window, document, BytePushers));
/*jslint unparam: false*/