@fluentui/react-northstar
Version:
A themable React component library.
27 lines (25 loc) • 1.03 kB
JavaScript
exports.__esModule = true;
exports.isRestrictedDate = void 0;
var _dateMath = require("../dateMath/dateMath");
var _isBeforeMinDate = require("./isBeforeMinDate");
var _isAfterMaxDate = require("./isAfterMaxDate");
/**
* Checks if `date` falls into the restricted `options`
* @param date - date to check
* @param options - restriction options (min date, max date and list of restricted dates)
*/
var isRestrictedDate = function isRestrictedDate(date, options) {
var restrictedDates = options.restrictedDates,
minDate = options.minDate,
maxDate = options.maxDate;
if (!restrictedDates && !minDate && !maxDate) {
return false;
}
var inRestrictedDates = restrictedDates && restrictedDates.some(function (rd) {
return (0, _dateMath.compareDates)(rd, date);
});
return inRestrictedDates || (0, _isBeforeMinDate.isBeforeMinDate)(date, options) || (0, _isAfterMaxDate.isAfterMaxDate)(date, options);
};
exports.isRestrictedDate = isRestrictedDate;
//# sourceMappingURL=isRestrictedDate.js.map
;