Issue with Hiding Non-Business Hours Spanning Two Days in DayPilot Scheduler
1 years ago.
I am using DayPilot Pro (version 2021.3.5046) in my Angular 8 application, and I’ve encountered an issue related to hiding non-business hours. The scheduler works fine for a single day, but when my business hours span 9 PM (21:00) on Day 1 to 6 AM (06:00) on Day 2, the non-business hours are not being hidden properly.
const config: SchedulerPropsAndEvents = {
startDate: "2024-01-01T21:00:00", // Start at 9 PM on Day 1
days: 2, // Show two days to account for business hours spanning over two days
businessBeginsHour: 21, // 9 PM
businessEndsHour: 6, // 6 AM the next day
showNonBusiness: false, // Hide non-business hours
onIncludeTimeCell: (args) => {
const businessStart = 21; // 9 PM (21:00)
const businessEnd = 6; // 6 AM (06:00) of the next day
const hour = args.cell.start.getHours();
const day = args.cell.start.getDay();
if ((hour >= businessStart) || (hour < businessEnd && day === 1)) {
return true; // Show the time cell (business hour)
}
return false; // Hide the time cell (non-business hour)
},
};
For a single day, the scheduler hides non-business hours correctly.
However, when spanning two days, the non-business hours are not hidden, and the cells before 9 PM and after 6 AM are still visible.
Could you please assist with how to properly hide non-business hours when the business hours span across two days (9 PM to 6 AM)?
DayPilot