Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 15x 48x 1x 47x 1x 46x 1x 45x | import { isAfter, isBefore, isSameDay } from "date-fns" /** * * @param {Object} * @property {Date} date * @property {Date} maxDate * @property {Date} minDate * @property {Date[]} disabledDates * * @returns {boolean} */ export const isDisabled = ({ date, maxDate, minDate, disabledDates }) => { if (disabledDates.some(disabledDate => isSameDay(date, disabledDate))) { return true } if (isBefore(date, minDate)) { return true } if (isAfter(date, maxDate)) { return true } return false } |