我有一个自定义日历,当你点击日期时它将显示该日期的事件,例如我点击了2018-08-22的日期,我的PHP代码将在该日期获得该事件
[ { "title": "Basket Ball", "start": "2018-08-22T10:00:00", "end": "2018-08-22T11:00:00", "backgroundColor": "#ff0000" },
{ "title": "Free slots", "start": "06:00:00", "end": "10:00:00", "backgroundColor": "#44cc00" },
{ "title": "Free slots", "start": "11:00:00", "end": "22:00:00", "backgroundColor": "#44cc00" } ]
它看起来像这样https://ibb.co/nHttqz
但是当我点击2018-08-23并将这个json传递给fullcalendar
[ { "title": "Dance Practice", "start": "2018-08-23T06:00:00", "end": "2018-08-23T07:00:00", "backgroundColor": "#ff0000" },
{ "title": "Free slots", "start": "06:00:00", "end": "06:00:00", "backgroundColor": "#44cc00" },
{ "title": "Free slots", "start": "07:00:00", "end": "22:00:00", "backgroundColor": "#44cc00" } ]
但是当我把我的电脑日期/时间改为2018-08-23时,它将在第二张图像中显示该事件,这是舞蹈练习,我再也看不到该事件在2018-08-22晚上10点这是篮球,但它出现了它不是免费的插槽
我每次点击自定义日历时都尝试更改fullcalendar的defaultDate,但仍然没有运气
这是我的fullCalendar代码
$('#calendar').fullCalendar( 'destroy');
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultDate: '$clickedDate'//php code
minTime: '06:00:00',
maxTime: '23:00:00',
defaultView: 'agendaDay',
allDaySlot: false,
header: false,
navLinks: true,
editable: false,
eventLimit: true,
events: ".$str.",//json pass by php
});
});