UNPKG

@fluentui/react-northstar

Version:
28 lines (26 loc) 911 B
"use strict"; exports.__esModule = true; exports.getBoundedDateRange = void 0; var _dateMath = require("../dateMath/dateMath"); /** * Generates a list of dates, bounded by min and max dates * @param dateRange - input date range * @param minDate - min date to limit the range * @param maxDate - max date to limit the range */ var getBoundedDateRange = function getBoundedDateRange(dateRange, minDate, maxDate) { var boundedDateRange = [].concat(dateRange); if (minDate) { boundedDateRange = boundedDateRange.filter(function (date) { return (0, _dateMath.compareDatePart)(date, minDate) >= 0; }); } if (maxDate) { boundedDateRange = boundedDateRange.filter(function (date) { return (0, _dateMath.compareDatePart)(date, maxDate) <= 0; }); } return boundedDateRange; }; exports.getBoundedDateRange = getBoundedDateRange; //# sourceMappingURL=getBoundedDateRange.js.map