Uncaught TypeError: Cannot read properties of undefined (reading 'hasTime') in fullcalendar

Uncaught TypeError: Cannot read properties of undefined (reading 'hasTime') in fullcalendar

完整日历显示时遇到错误。我从 servlet 收到了以下格式的 JSON。

类型 1:[["title2","2021-09-10","2021-09-10"],["title2","2021-09-10","2021-09-10"],

类型 2:[["title2","2021-09-10","2021-09-10"],["title2","2021-09-10","2021-09-10"]]

这是我在 Google chrome 的控制台中看到的错误:

我的代码:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.js'></script>
<link rel='stylesheet' href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" />

<div id='calendar'></div>
$(document).ready(function() {
  var s = '';
  var value;
  var datavlue;
  
  $.ajax({
    url: 'CalendarEventController',
    dataType: "json",
    success: function(response) {
      console.log(response);
      value = response;

      s = '[';

      $.each(value, function(index, v) {
        s += '["' + v.title + '","' + v.start + '","' + v.end + '"],';
      });
      console.log(s);
      var d = s.slice(0, -1)
      d += ']';
      console.log(d);
      datavlue = JSON.parse(d);
      console.log(datavlue)
      $('#calendar').fullCalendar({
        // put your options and callbacks here
        left: 'Calendar',
        center: '',
        right: 'today prev,next',
        editable: true,
        events: [datavlue],
      })

    }
  });
});

如果您将 response 作为 events 的值,日历应该可以工作

$(document).ready(function() {
  var s = '';
  var value;
  var datavlue;
  
  var response = [{title: 'title2', start: '2021-09-10',end:'2021-09-10'}, {title: 'title2', start: '2021-09-10',end:'2021-09-10'}]
  
      $('#calendar').fullCalendar({
        // put your options and callbacks here
        left: 'Calendar',
        center: '',
        right: 'today prev,next',
        editable: true,
        events: response,
      })

    
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.js'></script>
<link rel='stylesheet' href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" />

<div id='calendar'></div>