FullCalendar 事件显示为当前时间而不是实际开始时间
FullCalendar events showing up as current time rather than their actual start time
我很想在 fullCalendar via a JSON feed 中显示事件,它一直显示当前时间的事件,而不是通过提要提供的时间:
function getAvailableDates() {
$("#availabilitySchedule").fullCalendar({
events: {
url: window.location.href + '/available_dates',
type: 'GET',
dataType: 'JSON',
data: {
startParam: 'availability_start',
endParam: 'availability_end',
allDay: false,
}
},
allDaySlot: false,
slotEventOverlap: false,
editable: false,
droppable: false,
unselectAuto: true,
timezone: 'local',
});
}
这是我的 JSON 供稿的样子:
[{"id":20,"professional_id":49,"availability_start":"2015-01-29T14:18:00.000Z","availability_end":"2015-01-29T21:18:00.000Z","recurrances":"single","created_at":"2015-01-28T21:18:38.000Z","updated_at":"2015-01-28T21:18:38.000Z"}]
知道是什么导致了这种情况吗?
好的,看来我找到了答案 here。这是我现在拥有的,现在对我来说似乎工作正常:
events: function (start, end) {
$.ajax({
url: window.location.href + '/available_dates',
dataType: 'json',
success: function (data) {
var events = [];
$.each(data, function (index) {
events.push({
"start": data[index].availability_start,
"end": data[index].availability_end
});
});
callback(events);
},
error: function () { alert('Oh no!'); },
});
}
我很想在 fullCalendar via a JSON feed 中显示事件,它一直显示当前时间的事件,而不是通过提要提供的时间:
function getAvailableDates() {
$("#availabilitySchedule").fullCalendar({
events: {
url: window.location.href + '/available_dates',
type: 'GET',
dataType: 'JSON',
data: {
startParam: 'availability_start',
endParam: 'availability_end',
allDay: false,
}
},
allDaySlot: false,
slotEventOverlap: false,
editable: false,
droppable: false,
unselectAuto: true,
timezone: 'local',
});
}
这是我的 JSON 供稿的样子:
[{"id":20,"professional_id":49,"availability_start":"2015-01-29T14:18:00.000Z","availability_end":"2015-01-29T21:18:00.000Z","recurrances":"single","created_at":"2015-01-28T21:18:38.000Z","updated_at":"2015-01-28T21:18:38.000Z"}]
知道是什么导致了这种情况吗?
好的,看来我找到了答案 here。这是我现在拥有的,现在对我来说似乎工作正常:
events: function (start, end) {
$.ajax({
url: window.location.href + '/available_dates',
dataType: 'json',
success: function (data) {
var events = [];
$.each(data, function (index) {
events.push({
"start": data[index].availability_start,
"end": data[index].availability_end
});
});
callback(events);
},
error: function () { alert('Oh no!'); },
});
}