这是我的代码。没有错误,但我不知道为什么我的活动没有出现在日历中。
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);
}
});
}
答案 0 :(得分:0)
我找到了答案。
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之前,应该在c#中合并日期和时间