Highlighting multiple dates in scheduler
2 years ago.
Hello, I am using the scheduler component and I need to highlight several sections of the calendar based on an arrangement of dates with times, example:
-
illuminate 2024-02-05 01:00 - 03:00 (not highlighted)
-
illuminate 2024-02-06 01:00 - 03:00 (not highlighted)
-
illuminate 2024-02-07 01:00 - 03:00 (highlighted)
but no matter how hard I tried, I only get the last block to highlight
let datesArray: string[] = ['2024-02-05', '2024-02-06', '2024-02-07'];
datesArray.forEach((date: Date) => {
const ds = new DayPilot.Date(date + ' ' + formData.startHour.selected.startHour + ':00'); // 'date + 01:00:00'
const de = new DayPilot.Date(date + ' ' + formData.endHour.selected.endHour + ':00'); // 'date + 03:00:00'
configCalendar.value.onBeforeCellRender = (args) => {
if (
args.cell.start.getDatePart() === new DayPilot.Date(date) &&
args.cell.start >= ds &&
args.cell.start < de
) {
args.cell.backColor = 'rgba(223, 242, 227, 0.7)';
}
};
});
scheduler.value.control.update();
DayPilot