javascript-fullcalendar不显示基于事件时间的事件
作者:互联网
我正在Hero Framework中构建事件日历.我已经通过JSON方法将全日历链接到数据库.记录显示的开始时间为“ 2012-04-18 12:00”,结束的时间为“ 2012-04-18 14:00”,但是日历未能按时间显示事件.显示为全天事件.知道如何解决吗?
<script type='text/javascript'>
$(document).ready(function() {
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',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true,
allDaySlot: false,
firstHour: 9,
select: function(start, end) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end
},
false // make the event "stick"
);
var startDateString = $.fullCalendar.formatDate(start, 'yyyy-MM-dd hh:mm');
var endDateString = $.fullCalendar.formatDate(end, 'yyyy-MM-dd hh:mm');
$.ajax({
type: 'POST',
url: '{url}ajaxpost/add',
data: {
startDate: startDateString,
endDate: endDateString,
eventTitle: title
},
dateType: 'json',
success: function (resp) {
calendar.fullCalendar('refetchEvents');
}
});
}
calendar.fullCalendar('unselect');
},
editable: true,
events: "{url}ajaxget/data",
});
});
解决方法:
您需要将事件allDay属性设置为false
标签:fullcalendar,javascript 来源: https://codeday.me/bug/20191101/1983894.html