I'm using fullcalendar and everything looks good except after calling toJSON to serialize the data. The dates, which are formatted like "Wed 29, June" etc., becomes "start: {}" which is not what I need. What am I missing?
Any idea why it's turning date's into {}?
Here is the script:
$(document).ready(function() {
$('#calendar').fullCalendar({
dayClick: function(date, allDay, jsEvent, view) {
$(this).css('background-color', 'red');
},
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
aspectRatio: 1.5,
editable: true,
events: "/Calendar/CalendarData"
});
});
The date looks good in the event, but after toJSON call, the dates get converted to {}.
Here is the toJSON call:
var event = $('#calendar').fullCalendar('clientEvents');
var jlst = $.toJSON(event);
$.post("/Calendar/AddCalendar", { jsonData: jlst },
function(data, textStatus) {
if (textStatus != "success") {
result = "false";
}
});
Here is what the date looks like before call to toJSON:
"Wed Jun 23 2010 06:00:00 GMT-0400 (Eastern Daylight Time) {}"
Here is the serialized data. Note the start and end fields have changed:
"[{\"id\":\"69cf0853-40e3-4d29-8dc6-9d8b83e9696d\",
\"title\":\"Second Schedule",
\"start\":{},
\"end\":{},
\"allDay\":false,
\"_id\":\"69cf0853-40e3-4d29-8dc6-9d8b83e9696d\",
\"_start\":{},
\"_end\":{},
\"className\":[],
\"source\":\"/Calendar/CalendarData\"}]"
Any tips will be much appreciated. Thanks.