We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to round off the minutes while drag and dropping the appointment?

Platform: ASP.NET MVC |
Control: Schedule

The following steps helps you to round off the appointment dragging interval to specific time such as 15 minutes.

Step 1:  Create an MVC application and include the EJMVC Schedule control in it by referring the following KB link,


Step 2: Define the DragStop event for Scheduler with appropriate handler. When the appointment is drag and dropped, this event will raise where we can round-off the appointment dragging minutes.

        .TimeZone("UTC -03:00")      
        .CurrentDate(new DateTime(2015, 11, 12))
        .ScheduleClientSideEvents(evt => evt.DragStop("onDragStop")) // this event will raise when the appointment is drag and dropped
        .AppointmentSettings(fields => fields.Datasource(ds => ds.URL("/Home/GetData").CrudURL("/Home/Batch").Adaptor("UrlAdaptor"))


Step 3: onDragStop is a function within which the code to round-off the drag and dropped appointment minutes is defined as shown in the below code example,

function onDragStop(args) { // this function will be called when the appointment is drag and dropped
        var start=args.appointment.StartTime; // start time of the appointment will be retrieved
        var starthr=15 * Math.round( start.getMinutes() / 15 ); // here we are rounding off the minutes
            args.appointment.StartTime.setHours(args.appointment.StartTime.getHours()+1); // here we are incrementing the start hour when the minutes is equal to 60
        args.appointment.StartTime.setMinutes((Math.round(start.getMinutes()/15)*15 )% 60); // here we are adding the round off start minutes to the appointment
        var end=args.appointment.EndTime;
        var endhr=15 * Math.round( end.getMinutes() / 15 );
        args.appointment.EndTime.setMinutes((Math.round(end.getMinutes()/15)*15 )% 60);



If you wish to round-off to other intervals, replace the value 15 with your appropriate minute value

Step 4: Run the sample and now you can see the time difference of 15 minutes as dragging interval as shown in the below images,


Appointment is drag and dropped to Nov 12, 2015 12.10 PM

Figure 1: Appointment is drag and dropped to Nov 12, 2015 12.10 PM.


Appointment minutes rounded-off to the interval of 15 minutes

Figure 2: Appointment minutes rounded-off to the interval of 15 minutes.


Sample Link: http://www.syncfusion.com/downloads/support/directtrac/155535/ze/Drag_and_drop1794655969


2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile