Search code examples
javascriptjqueryfullcalendarselectablejquery-ui-selectable

how to access dates from the selectable property in fullcalendar


FullCalendar lets you set selectable: true; meaning you can highlight multiple days on the calendar. I am trying to allow users to create an event that starts and ends on the days selected and highlighted by fullcalendar. Is this possible?


Solution

  • You have to wait for select callback, there you receive the start and the end of the selection.

    From the documentation - Select(callback)

    A callback that will fire after a selection is made.

    function( start, end, jsEvent, view )

    start is a Moment indicating the beginning of the selection.

    end is a Moment indicating the end of the selection. It is an exclusive value, so if the selection is all-day, and the last day is a Thursday, end will be Friday.)

    example:

    select: function(start, end, view)
            {
                window.location = "edit_event_form.cfm?&start_date="+start+"&end_date="+end+"&view="+view;
            }