0
votes

When a user clicks on a day slot in a month view in the Fullcalendar dayClick event I'd like to have a "past date" alert if a date and a time of the day is less than the date and time is now. The fullcalendar is integrated in a ASP.NET MVC app.

Thank you very much for your help!

2

2 Answers

1
votes

You want something like this

$('#calendar').fullCalendar({
    dayClick: function(date, allDay, jsEvent, view) {

        var today=new Date();
        if(today.getHours() != 0 && today.getMinutes() != 0 && 
           today.getSeconds() != 0 && today.getMilliseconds() != 0){
            today.setHours(0,0,0,0);
        }
        if (date<today){
            alert("Past Date");
        }
    }
});
0
votes

For example:

dayClick: function( date, allDay, jsEvent, view ) { 
                var myDate = new Date();

                if (date < myDate) {
                    //TRUE Clicked date smaller than today + daysToadd
                    alert("Past Date");
                }
                else
                {
                    //FLASE Clicked date larger than today + daysToadd
                    alert("Good choice");   
                 }   
            }    

You can try it here: http://jsfiddle.net/SteveButabi/RAmYV/