How can I automatize EndTime?

Hi! I need my scheduler to set an automatic EndTime when the user sets an appointment. I need a custom Edit Window without End Time field wich sets automatically (10 minutes after Start Time for example). I can't post any code becaus eI didn't realize to code anything useful. Thanks!!


1 Reply

RM Ruksar Moosa Sait Syncfusion Team May 4, 2022 01:45 PM UTC

Hi Javier,


You can fix the appointment duration by adding the required minutes from the startTime and assign it to the endTime of the appointment in the OnPopupOpen event like the below code snippet.


public void OnPopupOpen(PopupOpenEventArgs<AppointmentData> args)

    {

        if (args.Type == PopupType.Editor || args.Type == PopupType.QuickInfo)

        {

            args.Data.EndTime = args.Data.StartTime.AddMinutes(10);

        }

    }


To hide the End time field, you can overwrite the default CSS like the below code


<style>

    .e-schedule-dialog .e-end-container {

        visibility: hidden;

    }

</style>


Output:


Graphical user interface, text, application, email

Description automatically generated


Kindly try the attached sample and let us know if this meets your requirement.


Regards,

Ruksar Moosa Sait


Attachment: FixedAppointmentDuration_cea74f64.zip

Loader.
Up arrow icon