在事件渲染中我需要更改激活事件的日期颜色。对于前: 开始:'2015-04-23'并结束:'2015-04-28'。为此,我需要更改日期颜色。
我的代码是,
events: function (start, end, timezone, callback) {
$.ajax({
url: '@Url.Action("LoadStayEvents", "Vendor")',
contentType: "application/json; charset=utf-8",
datatype: "json",
data: "{'stayid':'4'}",
type: "POST", // 'GET' or 'POST' ('GET' is the default)
success: function (data) {
data = JSON.parse(data);
var events = [];
$.each(data, function (i, item) {
alert(item.GUESTINFO);
events.push({
title: item.GUESTINFO,
start: moment(item.STARTDATE).utc().format("YYYY-MM-DD HH:mm"),
end: moment(item.ENDDATE).utc().format("YYYY-MM-DD HH:mm"),
eventColor: '#378006',
});
});
callback(events);
},
error: function (xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
}
});
},
eventRender: function (event, element) {
var date1 = moment(event.start).utc().format("YYYY-MM-DD HH:mm");
var date2 = moment(event.end).utc().format("YYYY-MM-DD HH:mm");
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
alert(diffDays);
//var dataToFind = moment(event.start).format('YYYY-MM-DD');
//$("td[data-date='" + dataToFind + "']").addClass('activeDay');
},
提前谢谢