无法读取未定义的属性(读取 'formatDate')
Cannot read properties of undefined (reading 'formatDate')
我的代码有什么问题?
Cannot read properties of undefined (reading 'formatDate')
editable:true,
eventResize:function(event)
{
console.log(event.start);
var start = $.fullCalendar.formatDate(event.start, "YYYY-MM-DD HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "YYYY-MM-DD HH:mm:ss");
var title = event.title;
var id = event.id;
$.ajax({
url:"../Components/calendar/update.php",
type:"POST",
data:{title:title, start:start, end:end, id:id},
success:function(){
calendar.fullCalendar('refetchEvents');
alert('Event Update');
}
})
}
Console.log 个 event.start
这是旧版本
$.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
解决方案:
moment(event.start, 'DD.MM.YYYY').format('YYYY-MM-DD HH:mm:ss')
当您 select 完整日历上的开始和结束日期也使用以下代码时:
select: function(start, end) {
var start_date = moment(start).format('YYYY-MM-DD HH:mm:ss'));
var end_date = moment(end).format('YYYY-MM-DD HH:mm:ss'));
我的代码有什么问题?
Cannot read properties of undefined (reading 'formatDate')
editable:true,
eventResize:function(event)
{
console.log(event.start);
var start = $.fullCalendar.formatDate(event.start, "YYYY-MM-DD HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "YYYY-MM-DD HH:mm:ss");
var title = event.title;
var id = event.id;
$.ajax({
url:"../Components/calendar/update.php",
type:"POST",
data:{title:title, start:start, end:end, id:id},
success:function(){
calendar.fullCalendar('refetchEvents');
alert('Event Update');
}
})
}
Console.log 个 event.start
这是旧版本
$.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
解决方案:
moment(event.start, 'DD.MM.YYYY').format('YYYY-MM-DD HH:mm:ss')
当您 select 完整日历上的开始和结束日期也使用以下代码时:
select: function(start, end) {
var start_date = moment(start).format('YYYY-MM-DD HH:mm:ss'));
var end_date = moment(end).format('YYYY-MM-DD HH:mm:ss'));