UNPKG

@sebgroup/frontend-tools

Version:
25 lines (20 loc) 706 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var isValidDate = require('../isValidDate/isValidDate.js'); /** * Compare two dates and return true if the first date is the same as the second date ignoring the time. * * @param {Date} a The first date, * @param {Date} b The second date * @returns {boolean} True if date `a` is the same as date `b` */ function isSameDate(a, b) { if (isValidDate.isValidDate(a) && isValidDate.isValidDate(b)) { a.setHours(0, 0, 0, 0); b.setHours(0, 0, 0, 0); return a.valueOf() === b.valueOf(); } return a > b; } exports.isSameDate = isSameDate; //# sourceMappingURL=isSameDate.js.map