Fullcalender调度程序:无法使用js获取开始和结束日期



我是一个编码初学者。目前我正在使用Fullcalender的调度器(免费版(。我无法使用javascript获取开始和结束日期。我尝试了很多方法。有人,请帮忙!!

document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',   

slotMinTime :'08:00:00',  //start time to be shown in the grid
slotMaxTime : '19:00:00', //end time to be shown in the grid    
height: '100%',
aspectRatio: 1.8,
editable: true,
now: new Date(),
scrollTime: '00:00', 
headerToolbar: {
left: 'today prev,next',
center: 'title',
right: 'resourceTimelineDay,resourceTimelineTenDays,timeGridWeek,dayGridMonth,listWeek'
},
initialView: 'resourceTimelineDay',
views: {
resourceTimelineTenDays: {
type: 'resourceTimeline',
duration: { days: 10 },
buttonText: '10 days'
}
},
expandRows: true,
resourceAreaWidth: '10%',
resourceAreaHeaderContent: 'Machine',
resources: [
{ id: '1', title: '1' , eventColor: 'blue'},
{ id: '2', title: '7', eventColor: 'green' },
{ id: '3', title: '8', eventColor: 'orange' },
{ id: '4', title: '11', eventColor: 'red'  },
{ id: '5', title: '9', eventColor: 'yellow' },
],
events :'pages/load.php',
selectable:true,
selectHelper:true,
select: function(start, end, allDay)
{
$('#start').val(start.format("Y-MM-DD HH:mm:ss")); // here is my issue
$('#end').val(end.format("Y-MM-DD HH:mm:ss"));
$('#add_Modal').modal('show');   
});  
calendar.render();
});

有什么问题吗?如何获取起始值和结束值。我也试过了。


var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");
var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");

我拿到了。它是

var title = info.event.title; //gives Thu Jul 30 2020 17:30:00 GMT+0900
var start =info.event.start;

谢谢大家。

相关内容

  • 没有找到相关文章

最新更新