prevent scheduling into the past dates via dragging ...

Hi To All,

Just want to share how I made the prevention of scheduling into the past dates. Please note the use of jquery.dateFormat-1.0.js plug-in.

                /**
                 * prevent scheduling into the past dates via dragging
                 */
                scheduler.attachEvent("onBeforeEventChanged", function(event_object, native_event, is_new)
                {
                        start_date = $.format.date(event_object.start_date, "yyyy-MM-dd");
                        curr_date = new Date();
                        curr_date = $.format.date(curr_date,"yyyy-MM-dd");

                        if (curr_date > start_date) {
                                return false;
                        }
                        return true;
                });

                /**
                 * prevent scheduling into the past dates via form editing
                 */
                scheduler.attachEvent("onEventSave",function(id,data,is_new_event)
                {
                        curr_date = new Date();
                        curr_date = $.format.date(curr_date,"yyyy-MM-dd");
                        start_date = $.format.date(data.start_date, "yyyy-MM-dd");

                        if (curr_date > start_date)
                        {
                                alert('WARNING! curr_date: '+curr_date+ ' > start_date: '+start_date);
                                return false;
                        }
                        return true;
                });

Cheers!

Looks interesting.
By the way, it can be adjusted to work without jQuery

var myformat = scheduler.date.date_to_str(“Y-m-d”);

and later you can replace
$.format.date(event_object.start_date, “yyyy-MM-dd”);
with
myformat(event_object.start_date);

Awesome! Many thanks …