Bootstrap FullCalendar Uncaught TypeError: undefined is not a function

Bootstrap FullCalendar Uncaught TypeError: undefined is not a function

我正在使用 FullCalendar 制作一个调度程序。我似乎无法向我的 mysql 数据库添加任何事件,因为我收到错误消息:

未捕获类型错误:undefined 不是一个函数。

Chrome 突出显示以下行:

var start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");

知道为什么吗?我有 fullCalendar v 2.1.1。正确引用。

这是完整的脚本。

//do all the calendar stuff for adding a new appt.
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

var calendar = $("#calendar").fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },
    editable: true,
    slotDuration: '00:10:00',
    defaultView: 'agendaWeek',
    draggable: true,
    events: 'json_appointments.php',
    eventRender: function(event, element, view) {
        if (event.allDay == true) {
         event.allDay = true;
        } else {
         event.allDay = false;
        }
   },
    eventClick:  function(event, jsEvent, view) {
        $('#modalTitle').html(event.title);
        $('#modalBody').html(event.reason + ' ' + event.pre_notes);
        $('#fullCalModal').modal();
    },
     loading: function(bool) { 
        if (bool) $('#loading').show(); 
        else $('#loading').hide(); 
     },
    selectable: true,
    selectHelper: true,
    select: function(start, end, allDay) {
       var title = prompt('Event Title:');
       if (title) {
           var start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
           var end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
           $.ajax({
               url: 'ajax_add_appt.php',
               data: 'title='+ title+'&start='+ start +'&end='+ end,
               type: "POST",
               success: function(json) {
               alert('Added Successfully');
               }
           });
           calendar.fullCalendar('renderEvent',
               {
               title: title,
               start: start,
               end: end,
               allDay: allDay
               },
            true // make the event "stick"
           );
       }

       calendar.fullCalendar('unselect');
   },
   eventDrop: function(event, delta) {
       var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
       var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
       $.ajax({
           url: '',
           data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
           type: "POST",
           success: function(json) {
                alert("Updated Successfully");
           }
       });
    },
   eventResize: function(event) {
       var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
       var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
       $.ajax({
        url: 'http://localhost:8888/fullcalendar/update_events.php',
        data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
        type: "POST",
        success: function(json) {
         alert("Updated Successfully");
        }
       });

    }
});

感谢您的评论。我确实有 moment.js 被引用。

我只需要像这样编辑我的脚本:

var start=moment(start).format('YYYY-MM-DDTHH:mm:ssZ'); 
var end=moment(end).format('YYYY-MM-DDTHH:mm:ssZ'); 

...基于 Alvaro 提到的另一个堆栈 link。谢谢。