vipin
vipin

Reputation: 678

fullcalendar eventConstraint not working

I am using fullcalendar and i came to a situation that i want to restrict the events from dragging out side a date range,so i use eventconstraint but unfortunately its not working for me please correct me if there is any mistake in my code .I have made a fiddle with my code

$(document).ready(function() {

    var date = new Date();

    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        editable: true,
        eventConstraint:{    
                            start: '2015-02-01T10:00:00',
                            end: '2015-02-15T22:00:00'
                        },
        events: [
            {
                id: 999,
                title: 'event',
                start: new Date(2015, 1, 4)
            },
        ],
    });

});

Upvotes: -1

Views: 2097

Answers (1)

DanielST
DanielST

Reputation: 14163

Your fiddle is using fullcalendar 1.6.1

The current version is 2.2.6.

eventConstraint was just added in 2.2.

Here's a fiddle that works (you also need momentjs for FC 2.0+).

CDN scripts:

https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.6/fullcalendar.min.js http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.6/fullcalendar.min.css

Always load moment before fullcalendar.

Upvotes: 1

Related Questions