3
I’m implementing the FullCalendar
in a project, I inserted some Events in the database and return them via Json
. But when displaying them on the screen, they come with the correct time date, but the display does not show in the right place.
Example, the data comes with the start date of the event at 06:00, but is displayed at 10:00 am.
In the image below, the event is scheduled to start at 06:30, and end at 07:00.
But it shows on the screen that the time is 10:30
My model Eventos
:
public class Eventos
{
[Key]
public int ID { get; set; }
public string title { get; set; }
public DateTime start { get; set; }
public DateTime? end { get; set; }
public int StatusEnum { get; set; }
}
My method that searches the data is like this:
public JsonResult ObterEventos(string start, string end)
{
var db = new AgendaOnlineFc();
var dtInicial = Convert.ToDateTime(start).Date;
var dtfinal = Convert.ToDateTime(end).Date;
var lista = db.Eventos
.Where(d => d.end < dtfinal && d.start > dtInicial)
.ToList();
return Json(lista, JsonRequestBehavior.AllowGet);
}
The return of mine Json
is like this:
{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 I’m missing in this implementation ?
Hello Renan, please add a print showing how the date is coming to the browser
– Leandro Araujo