i just loved the fullcalendar and wanted to implement it in a small application, everythin worked OK. i am able to get the events from my database through json to the front end. but all events are being listed as "ALL-DAY" events itself. not able to figure out why.. here is the screenshot for the same. any ideas what is going wrong..? i am using asp.net and c#. i have already tried sending the start and end dates in the ToString(), ToShortDateString(), ToString("s"), ToLongDateString(), ToUniversalTime(). nothing seems to working for me at the moment. i tried hard coding and sendin the data too. sample json of my data
[{
"id": "2",
"title": "Event2开发者_开发问答",
"start": "1274171700",
"end": "1274175600"
},
{
"id": "1",
"title": "Event1",
"start": "5/18/2010 16:30:00",
"end": "5/18/2010 19:30:00"
},
{
"id": "3",
"title": "Event3",
"start": "5/18/2010 2:05:00 PM",
"end": "5/18/2010 3:10:00 PM"
},
{
"id": "4",
"title": "Event4",
"start": "5/18/2010",
"end": "5/18/2010"
},
{
"id": "5",
"title": "Event5",
"start": "2010-05-18T14:05:00",
"end": "2010-05-18T15:10:00"
}]
all data above has different formats of dates, and at the moment nothing seems to be working. fullcalender accepts the day part fine, but not the time part. not sure why. can anybody help?
Ok, i got it where the problem was. the allDay : false property was being rendered as "allDay":"false"
by the Newtonsoft.Json library. the false within the quotes was the main culprit. just did
.Replace("\"false\"","false")
and it worked like charm! surprisingly it had nothing to do with the dates! thanks anyways..
Edit : Noticed a few more things, just listing it down
- the start and end dates have to be formatted this way
String.Format("{0:MM/dd/yyyy HH:mm:ss}", startDate)
this formats the time part into 24 hrs, - allDay property is somewhat compulsory (not sure). cos when you dont mention allDay : false, it defaults to true, and does not show up as expected.
- Already mentioned above, the allDay : false, the false is supposed to be without the quotes. Everybody using the Newtonsoft.Json library will be facing this issue for sure.
thats all for now!
精彩评论