jQuery FullCalendar JSON date issue
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 as documented at their site.
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!
make sure to set the allDay
property to false
for each event object
(http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
Also, if your dates aren't padded with zeros, then the events won't show.
Ex. 2010-9-5 bad
Ex. 2010-09-05 good
精彩评论