jQuery FullCalendar JSON date issue

Posted by durilai on Stack Overflow See other posts from Stack Overflow or by durilai
Published on 2010-03-15T05:57:29Z Indexed on 2010/03/15 5:59 UTC
Read the original article Hit count: 1276

Filed under:
|
|
|
|

I am integrating jQuery plugin FullCalendar, overall it has been really straightforward. I however have ran into a problem with adding events to the calendar. I am using ASP.NET MVC 1.0 and have found and followed this post.

I am returning JSON to the FullCalendar and the events are getting bound, but they all show up as all day events. I am formatting the dates as ISO8601 format.

Calendar Javascript

$('#calendar').fullCalendar({
    events: "/Calendar/GetEvents/"
});

JsonResult

public JsonResult GetEvents(double start, double end)
{
    var fromDate = Utility.Dates.ConvertFromUnixTimestamp(start);
    var toDate = Utility.Dates.ConvertFromUnixTimestamp(end);

    List<GenericEventList> events = GETGENERICLISTOFEVENTS();
    return Json(events.ToArray()); 
}

JSON Result Value

[{"id":2,"title":"Test Event","start":"2010-03-14T11:00:00","end":"2010-03-14T16:00:00"},
{"id":3,"title":"Test Event1asasas","start":"2010-03-14T10:00:00","end":"2010-03-14T14:00:00"},
{"id":4,"title":"Test Event12","start":"2010-03-14T16:00:00","end":"2010-03-14T17:00:00"},
{"id":6,"title":"Test Event1aaa","start":"2010-03-14T10:00:00","end":"2010-03-14T14:00:00"}]

Any help is truly appreciated!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about fullcalendar