之前将日期和时间合并到C#中
这是我的代码。没有错误,但我不知道为什么我的事件没有在日历中出现。
events: function (start, end, timezone, callback) {
$.ajax({
url: '/Events/GetEvents',
dataType: 'json',
type: 'POST',
success: function (list) {
var events = [];
$.each(list, function (index, value) {
var date = new Date(value.startDate.split(' ')[0]);
var start = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + "T" + value.startTime + ":00";
date = new Date(value.endDate.split(' ')[0])
var end = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + "T" + value.endTime + ":00";
events.push({
id: value.ID,
title: value.Title,
start: start,
end: end,
allDay: value.isFullDayEvent
});
});
callback(events);
}
});
}
我找到了答案。
var date = new Date(value.startDate.split(' ')[0]);
var start = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + "T" + value.startTime + ":00";
date = new Date(value.endDate.split(' ')[0])
var end = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + "T" + value.endTime + ":00";
应删除这些行,并在发送回Ajax