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

How to limit time range in DayPilotCalendarWeek

Asked by khong giang dong
7 years ago.

I want to setup time range in 7AM-6PM

Answer posted by Richard
7 years ago.

Hi,

I would do the following:

1. First setup you're working hours:
dp.businessBeginsHour = 7;
dp.businessEndsHour = 18;

2. Then I'll handle the onEventMove as well as the onEventResize event: https://doc.daypilot.org/calendar/event-moving/ & https://doc.daypilot.org/calendar/event-resizing/ - which will allow me to force the user to work in the ranges specified in step 1:
// the onEventResize event handler would work in the same way....
dp.onEventMove = function (args) {
  if (someConditionIsTrue) {
    args.preventDefault();
    dp.message("Not Allowed");
  }
};
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.