We have a reservation system that allows a user to insert an appointment with a maximum of 90 minute duration. They can schedule it for less time, and have the resizing capability to extend it to 90 minutes. I have the JS in place to restrict a user from extending the end time beyond the 90 minutes, but if they size from the start, there seems to be no way to effectively capture this and check the duration limit.
This script works fine if you feed in the correct start and end times. However I have been unable to figure out how to get the new start time for a resized appointment, end time can be taken from args.get_newTime();
Does anyone have any idea how I can get the start time correct from a resized appointment?
Many thanks
Clyde
function warnIfTooLong(start, end, sender, args) { var appointment = args.get_appointment(); var finalTime = new Date(start); var maxDuration = 90; finalTime.setMinutes(finalTime.getMinutes() + maxDuration); if (end > finalTime) { alert("You cannot reserve a court for that duration."); args.set_cancel(true); } } This script works fine if you feed in the correct start and end times. However I have been unable to figure out how to get the new start time for a resized appointment, end time can be taken from args.get_newTime();
function onAppointmentResizeEnd(sender, args) { var start = args.get_appointment().get_start(); var end = args.get_newTime(); warnIfTooLong(start, end, sender, args);}Does anyone have any idea how I can get the start time correct from a resized appointment?
Many thanks
Clyde
