get clicked date/time



I’m using the dhtmlx scheduler as readonly calendar. Now i need to get the date/time on which the user clicked for an external input field.

I tried

scheduler.attachEvent(“onClick”, function (event_id, native_event_object){



but this is just working if the user clicks on an event, I also need it if he clicks on an empty space in the scheduler.

Thanks in advance,



You can assign event handler directly

//need to be called after scheduler.init
e = e||event;



Thanks, this works. It is called if I click on the calendar.

But now I have no idea which structure the object “e” has. Where can i find a documentation?

I would need the date/time from “e”.


In this case e is native event object. So this object doesn’t have any data properties.

You can try to use the following:

e = e||event;

var pos = scheduler._mouse_coords(e);

var timestamp = scheduler._min_date.valueOf()+(pos.y*scheduler.config.time_step+(scheduler._table_view?0:pos.x)2460)*60000;


I would also like to get the date the user clicked in whichever box in the scheduler.

this code throws an error: Uncaught SyntaxError: Unexpected number

this is strange to me because I do not understand all of what is going on here. But I got this to work by removing the 2460 number

	var pos=scheduler._mouse_coords(e);
	var start=scheduler._min_date.valueOf()+(pos.y*scheduler.config.time_step+(scheduler._table_view?0:pos.x))*60000;
	console.log(new Date(start));
return false;