I disable adding new event for past date but I wanted to allow user to edit it. I been using the code below to check if it is editable or not:
var isEditable = function (event_obj) {
if (!event_obj) {
var ev = event || window.event;
var date = scheduler.getActionData(ev).date; //getting cursor position
if (+date < +new Date()) {
dhtmlx.message("You can't add or edit appointments in the past");
return false;
}
return true;
}
if (typeof event_obj != 'object')
event_obj = scheduler.getEvent(event_obj);
if (!(event_obj && event_obj.start_date.getTime() > new Date().getTime())) {
dhtmlx.message("You can't add or edit appointments in the past");
return false;
} else {
return true;
}
};
How will I know that the user is creating a new event or editing previous event?
Does anyone have idea on this?
Any help is much appreciated.