Timelineview ignore_timeline - how to include the last hour as a valid drag target?

Hi there,

I have created a timeline view with primary scale that shows hours and a secondary scale which shows days:

It all looks and works fine but one detail. As you can see, the step is 2 and I don’t show the dates after 18:00 (for which I am using the ignore_timeline function and excluding the hours.

If the user drags an event and wants to release it at the 18:00 hours marker, it always locks to 10 am the next day. My time_step = 30 so that means I cannot lock it “close enough” to 18:00 and it is literally impossible to attach it at 18:00, even if the mouse pointer is on the left side of the vertical line. Is there some built-in way of including the “period end” (18:00) as a valid drag & drop target?

Thank you.

Hello @fxfn,

There is no specific config for that, but you can manually check the end_date of the event after drag, and if it’s 10:00, you can manually set it to 18:00 of the previous day. The code may look like follows:

scheduler.attachEvent("onDragEnd", function(id, mode, e){
  
    var event_end = new Date(scheduler.getEvent(id).end_date);
    if(event_end.getHours() == 10){
    	scheduler.getEvent(id).end_date = scheduler.date.add(event_end, -16, "hour")
    }	
});

Here is a demo:
https://snippet.dhtmlx.com/5/08738d065