Forbid events into the past?

Hi.
At the moment i’m working on some functions, to forbid moving an event into the past.

i’m avoiding new events with:

		/* checking if an event is in the past */
		scheduler.attachEvent("onBeforeDrag",pastCheck)
		scheduler.attachEvent("onClick",pastCheck)
		scheduler.attachEvent("onDblClick",pastCheck) 

                    function pastCheck(event_id, native_event_object){
				if(!event_id)return true
					// if event is in the past - disable to edit
					if(this.getEventStartDate(event_id) < new Date()) 
					{
						return this.getEvent(event_id).readonly; // set to readonly
					} else{
						return true; // allow to edit
					}
		  };

works good so far.

but i still can move an event from future to past.

i have seen this code in dhtmlxscheduler.js:

scheduler._copy_dummy = function() { this.start_date = new Date(this.start_date); this.end_date = new Date(this.end_date) }; scheduler._copy_event = function(A) { this._copy_dummy.prototype = A; return new this._copy_dummy() };

is this the way to work with?
copying the event on click and check after release, if event is in the past, restore it?

is there any better way to do it?
thanks in advance

Jörg

Check
viewtopic.php?f=6&t=12762

Attached extension doing exactly the same task.