@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
17 lines (16 loc) • 769 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSameDate = void 0;
const compare_dates_js_1 = require("./compare-dates.js");
const date_comparator_enum_js_1 = require("./date-comparator.enum.js");
/**
* Determines if two dates are the same. If you want to limit the granularity to a unit other than milliseconds, pass it as the second
* parameter.
*
* When including a second parameter, it will match all units equal or larger. For example, if passing in month will check month and year,
* or if passing in day will check day, month, and year.
*/
function isSameDate(a, b, unit) {
return (0, compare_dates_js_1.compareDates)(a, date_comparator_enum_js_1.DateComparator.Same, b, unit);
}
exports.isSameDate = isSameDate;