我使用完整日历来显示分配的轮班,并在完整日历中显示开始和结束时间。我将在数组中获取数据,并将值映射到事件中。在那里,如果我只为约会而做,它会正常工作。如果我在其中包含时间,它不会显示事件。有人能帮我解决这个问题吗。提前感谢
let apiData = [["11/07/2018","10:00",,"16:00","morningShift"],["11/08/2018","10:00",,"16:00","Shift1"]] // dynamic
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var form = '';
var today = new Date($.now());
$('#calendar').fullCalendar({
slotDuration: '00:15:00', /* If we want to split day time each 15minutes */
minTime: '00:00:00', /* calendar start Timing */
maxTime: '24:00:00', /* calendar end Timing */
defaultView: 'month',
handleWindowResize: true,
height: $(window).height() - 200,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
events : apiData.map(([startDate,start,end,title])=>({
start: new Date(startDate)+'T'+start, //mapping date
// with time
end: new Date(startDate)+'T'+end,
title,
className: 'bg-primary'})
),
timeFormat: 'H(:mm)'
});
}
我从后端连接了开始日期和时间,并将其传递给js。现在这很好