Calculate End Time from Start Time

Hi,

I want to keep end time as start time + 30 minutes as i don't want to store end time. Is it possible? If so please help me with a solution. I am trying to achieve this with your sample appointment planner.

Thanks in advance

3 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team October 30, 2017 10:33 AM UTC

Hi Freelancer,   
   
Thank you for contacting Syncfusion support. 
 
Start and EndTime are mandatory fields for appointment rendering, kindly visit the below link. 
 
Alternatively, we can enforce the user to enter only start time by disabling the end time field in appointment window and for the same we have prepared the below sample for your reference. 
 
<Code> 
.ScheduleClientSideEvents(e=>e.AppointmentWindowOpen("onOpen"))  
  
function onOpen(args) { 
    $("#Schedule1_appEndTime").css("display","none") 
} 
</Code> 
 
Note: If no EndTime is chosen, default time scale value (per cell) will be considered for appointment rendering. 
 
Regards, 
Karthigeyan 




FR Freelancer October 31, 2017 06:13 AM UTC

Is it possible to calculate ENDTIME before binding to the scheduler using start time?



KK Karthigeyan Krishnamurthi Syncfusion Team November 1, 2017 04:54 AM UTC

Hi Freelancer,  
 
Thanks for your update. 
 
Yes, it is possible. We have prepared the sample to calculate the end time before binding to Scheduler using start time which can be viewed from the below link.  
 
<Code> 
appointmentWindowOpen: "onOpen", 
beforeAppointmentCreate: "OnBeforeAppointmentCreate" 
 
function onOpen(args) { 
    $("#Schedule1_appEndTime").css("display", "none") 
} 
function OnBeforeAppointmentCreate(args) { 
    var app = ej.isNullOrUndefined(args.appointment[0]) ? args.appointment : args.appointment[0]; 
    var endTime = new Date(app.StartTime).setMinutes(app.StartTime.getMinutes() + 45); 
    app.EndTime = new Date(endTime); 
} 
</Code> 
 
Regards, 
Karthigeyan 



Loader.
Up arrow icon