我有这个熔化日历属性:
const {
elements: { calendar, heading, grid, cell, prevButton, nextButton },
states: { months, headingValue, weekdays },
helpers: { isDateDisabled, isDateUnavailable }
} = createCalendar({
defaultValue: new CalendarDate(year, month, day),
locale: 'ph',
fixedWeeks: true,
isDateUnavailable: (date) => {
return isWeekend(date, 'en')
}
});
我还可以使用以下方法禁用特定日期:
isDateDisabled: (date) => {
return date.day == 1
}
但我只能做一次。
我想禁用更多数组形式的日期,例如: 假期= [12/25,...]
您应该能够仅使用数组或集合函数。
集合效率更高,但可能不会太重要。
例如
const holidays = new Set(['12/25', ...]);
...
isDateDisabled: (date) => {
return holidays.has(date.month + '/' + date.day);
}