https://i.sstatic.net/v8Faj.png
My fullcalendar plug-in is causing some trouble. I'm trying to show events in the monthview of the calendar, but when I'm in the current month, events on the same day of the week are not displaying correctly. They end up showing on the Sunday block of that week. Take a look at the picture - the '4' event should be on the 13th, but it's appearing on the 8th. Even the drag and drop feature indicates that it's in the wrong place with the gray section underneath. This issue only occurs in the current month. Last time I checked my program, it was Tuesday and the Tuesday events of November were not showing properly.
https://i.sstatic.net/HHNGv.png
If I switch to another month, every day displays correctly. Does anyone have an idea why my current month events render like this? Below is my fullcalendar code. I am coding in ASP.NET using JavaScript and JSON for event rendering.
$('#calendar').fullCalendar({
theme: true,
header: {
right: 'today prev,next',
left: 'title'
},
defaultView: 'month',
eventClick: updateEvent,
selectable: true,
selectHelper: true,
select: selectDate,
timezone : 'local',
editable: true,
events: "../JsonResponse.ashx",
eventDrop: eventDropped,
eventResize: eventResized,
eventRender: function (event, element) {
//alert(event.title);
element.qtip({
content: {
text: qTipText(event.start, event.end),
title: '<strong>' + event.title + '</strong>'
},
position: {
my: 'bottom left',
at: 'top right'
},
style: { classes: 'qtip-dark qtip-rounded' }
});
This is the JSON data that is rendered:
[{"id":27,"title":"2.5","start":"2015-11-28T00:00:00","end":"2015-11-29T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":43,"title":"5","start":"2015-11-18T00:00:00","end":"2015-11-19T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":44,"title":"5.6","start":"2015-12-03T00:00:00","end":"2015-12-04T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":45,"title":"8","start":"2015-11-12T00:00:00","end":"2015-11-13T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":46,"title":"5","start":"2015-11-16T00:00:00","end":"2015-11-17T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":47,"title":"9","start":"2015-11-27T00:00:00","end":"2015-11-28T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":55,"title":"1","start":"2015-11-06T00:00:00","end":"2015-11-07T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":56,"title":"7","start":"2015-11-29T00:00:00","end":"2015-11-30T00:00:00","allDay":true,"id_projet":68,"id_employe":1}]
This is the function used to render the event list:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
// FullCalendar 2.x
DateTime start = Convert.ToDateTime(context.Request.QueryString["start"]);
DateTime end = Convert.ToDateTime(context.Request.QueryString["end"]);
int id_employe = Int32.Parse(context.Session["id_employe"].ToString());
int id_projet = Int32.Parse(context.Session["id_projet"].ToString());
List<int> idList = new List<int>();
List<ImproperCalendarEvent> tasksList = new List<ImproperCalendarEvent>();
//Generate JSON serializable events
foreach (CalendarEvent cevent in EventDAO.getEvents(start, end, id_projet, id_employe))
{
tasksList.Add(new ImproperCalendarEvent
{
id = cevent.id,
title = cevent.title,
id_projet = cevent.id_projet,
id_employe = cevent.id_employe,
// FullCalendar 2.x
start = String.Format("{0:s}", cevent.start),
end = String.Format("{0:s}", cevent.end),
allDay = true,
}
);
idList.Add(cevent.id);
}
context.Session["idList"] = idList;
//Serialize events to string
System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
string sJSON = oSerializer.Serialize(tasksList);
//Write JSON to response object
context.Response.Write(sJSON);
}