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
3 years 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]
3 years 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
)
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.