Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

// first the calendar
$(document).ready(function() {
    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:

\"title\":\"Second Schedule",

Any tips will be much appreciated. Thanks.
Updated 2-Jul-10 10:10am

1 solution

You have curly braces in your date string. {} is Javascript shorthand for:

var obj = new Object();

var obj1 = {};

Both produce new Object types. Remove the Curly braces from your date string and try again. :)
Share this answer
Manfred Rudolf Bihy 31-May-11 17:35pm    
Good catch! 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900