英文:
Uncaught TypeError: start.getDate is not a function
问题
我正在开发一个带有完整日历的预约系统。当选择一组日期时,我希望这些日期的值将被显示在一个div中,以便用户可以看到他选择的日期,并且还可以取消选择日期。
我一直在尝试使用console.log
来记录选择的日期,但是我得到了上面的错误。对我来说已经很难继续前进了。
var calendar = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
start: 'title',
center: '',
end: ''
},
initialView: 'dayGridMonth',
selectable: true,
select: function(date, jsEvent, view) {
date: date.getDate();
backgroundColor: 'green';
console.log('Selected: ' + date);
},
});
我已经尝试添加date.toString()
,但它不起作用。我还尝试使用日期的开始和结束,但仍然不按预期工作。
英文:
I am working on an appointment system with full calendar. I want when an array of dates are selected, the values of those dates will be echoed on a div for the user to see his selected dates and can also unselect the dates.
I have been trying to console.log selected dates but I get the above error. It is becoming impossible for me to move ahead.
<!-- language: lang-js -->
var calendar = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
start: 'title',
center: '',
end: ''
},
initialView: 'dayGridMonth',
selectable: true,
select: function(date, jsEvent, view) {
date: date.getDate();
backgroundColor: 'green';
console.log('Selected: ' + date);
},
)
};
I have added date.toString()
but it is not working. I have tried to use start and end of date but still not working as expect
答案1
得分: 1
根据文档,我看到 select
函数应该接受一个参数。例如:
select: function(selectionInfo){
// 这里可以使用:selectionInfo.start
}
英文:
Reading the documentation I see that the select function should accept one parameter. For example:
select: function(selectionInfo){
... // then here you can have: selectionInfo.start
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论