Node.js examples for Date:Compare
Compares two calendar events and determines their relationship
/**/*from w w w .j a va2 s .c om*/ * @description Compares two calendar events and determines their * relationship. Intended for sorting functions. * @param {Object} a: First date. * @param {Object} b: Second date. * @returns {Number} */ dateSort: function (a, b) { a = new Date(a.value.date); b = new Date(b.value.date); if (a.getTime() > b.getTime()) { return 1; } else { return -1; } }