Get selected date from fullcalendar

后端 未结 2 1198
情歌与酒
情歌与酒 2021-02-06 14:54

I added the calendar to my asp.net mvc 2 application from here .

I want to pick the selected date where I am going to enter the event. How can I get selected date?

2条回答
  •  爱一瞬间的悲伤
    2021-02-06 15:32

    Use this code when you setup the plugin

    $('#calendar').fullCalendar({
        selectable: true,
        select: function(start, end, jsEvent, view) {
             // start contains the date you have selected
             // end contains the end date. 
             // Caution: the end date is exclusive (new since v2).
             var allDay = !start.hasTime() && !end.hasTime();
             alert(["Event Start date: " + moment(start).format(),
                    "Event End date: " + moment(end).format(),
                    "AllDay: " + allDay].join("\n"));
        }
    });
    
    
    
    
    
    

    Please note that I have just included the options needed to answer your question.

    For further information refer to the very good made plugin documentation.

提交回复
热议问题