Thank you for contacting Syncfusion support.
We have prepared the sample to disable creating/editing of the past appointments which can be viewed form the below link.
<Code>
create: "onCreate",
actionBegin: "onBegin",
cellClick: "onOpen",
appointmentWindowOpen: "onOpen",
appointmentHover: "onHover",
dragStop: "onAction",
resizeStop: "onAction",
actionComplete: "onComplete",
cellHover: "onCellHover",
dragStart: "onStart",
resizeStart: "onStart",
beforeAppointmentCreate: "OnBeforeAppointmentCreate",
beforeAppointmentChange: "OnBeforeAppointmentChange",
function OnBeforeAppointmentCreate(args) {
if (ej.isNullOrUndefined(args.appointment[0]))
app = args.appointment;
else
app = args.appointment[0];
if (new Date(app.StartTime).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
function OnBeforeAppointmentChange(args) {
if (new Date(args.appointment.StartTime).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
function onStart(args) {
if (new Date(args.appointment.StartTime).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
function onCellHover(args) {
if (new Date(args.currentDate).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
function onOpen(args) {
if (ej.isNullOrUndefined(args.appointment)) {
if (args.startTime.setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
else {
if (new Date(args.appointment.StartTime).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
}
function onCreate() {
var scheduleObj = $("#Schedule1").data("ejSchedule");
if (scheduleObj.currentView() == "month") {
var monthElements = scheduleObj.element.find(".e-monthcells");
var dayIndex = scheduleObj._dateRender.indexOf(new Date().setHours(0, 0, 0, 0));
for (var a = 0, len = scheduleObj._dateRender.length; a < len; a++) {
if (scheduleObj._dateRender[a] < new Date().setHours(0, 0, 0, 0))
monthElements.eq(a).addClass("e-othermonths e-disable");
}
}
else {
var allDayElements = scheduleObj.element.find(".e-alldaycells");
for (var b = 0, len = scheduleObj._dateRender.length; b < len; b++) {
if (scheduleObj._dateRender[b] < new Date().setHours(0, 0, 0, 0)) {
scheduleObj.element.find(".e-workcellstab tr td:nth-child(" + (b + 1) + ")").addClass("e-disable");
allDayElements.eq(b).addClass("e-disable");
}
else {
scheduleObj.element.find(".e-workcellstab tr td:nth-child(" + (b + 1) + ")").removeClass("e-disable");
allDayElements.eq(b).removeClass("e-disable");
}
}
}
}
function onComplete(args) {
if (args.requestType == "dateNavigate" || args.requestType == "viewNavigate")
onCreate();
}
function onBegin(args) {
if (args.requestType == "appointmentResize" || args.requestType == "appointmentDrag") {
if (args.data.appointment.StartTime.getMonth() != new Date().getMonth())
args.cancel = true
}
}
function onHover(args) {
if (new Date(args.appointment.StartTime).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
function onAction(args) {
if (new Date(args.appointment.StartTime).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))
args.cancel = true
}
</Code>
Note: In above sample, appointments/cells which are before the system date is disabled.
Regards,
Karthigeyan