search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Disable hours range only in specific date cell

Asked by Anonymous
1 month ago.

I'm trying to disable specific hours range for selected date cell, but it does not working.

( args.cell.start === new DayPilot.Date("2020-12-02") && (args.cell.start.getHours() >= 7 && args.cell.start.getHours() < 15))

What is wrong in my condition?

Answer posted by Dan Letecky [DayPilot]
1 month ago.

The first condition is only true for the first cell in a day (which start at 00:00). You need to compare the date part instead:

(
  args.cell.start.getDatePart() === new DayPilot.Date("2020-12-02").getDatePart()
  && 
  args.cell.start.getHours() >= 7 
  &&
  args.cell.start.getHours() < 15
)
New Reply
This reply is
Your name (optional):