I'm implementing FullCalendar
in a project, I've inserted some Events in the database, and I return them via Json
. But by displaying them on the screen, they come with the correct date time, but the display does not show in the correct place.
Example, the data comes with the bank start date of the event at 06:00, but is displayed at 10:00 am.
In the image below, the event has start times at 06:30, and ends at 07:00.
Butitshowsonthescreenthatthetimeis10:30am
MymodelEventos
:
publicclassEventos{[Key]publicintID{get;set;}publicstringtitle{get;set;}publicDateTimestart{get;set;}publicDateTime?end{get;set;}publicintStatusEnum{get;set;}}
Mymethodthatlooksforthedatalookslikethis:
publicJsonResultObterEventos(stringstart,stringend){vardb=newAgendaOnlineFc();vardtInicial=Convert.ToDateTime(start).Date;vardtfinal=Convert.ToDateTime(end).Date;varlista=db.Eventos.Where(d=>d.end<dtfinal&&d.start>dtInicial).ToList();returnJson(lista,JsonRequestBehavior.AllowGet);}
ThereturnofmyJson
lookslikethis:
{ID:10,title:"teste", start: "/Date(1495449000000)/", end: "/Date(1495450800000)/", StatusEnum: 0}
ID:10
StatusEnum:0
end:"/Date(1495450800000)/"
start:"/Date(1495449000000)/"
title:"teste"
and my Script
,
$('#calendar').fullCalendar({
events: '/Home/ObterEventos/'
});
Is there any additional configuration to be made? Or if not where am I going wrong in this implementation?