| Issue 752: | Events misplaced when setting firstDay to anything other then 0. | |
| 1 person starred this issue and may be notified of changes. | Back to list |
When creating events with firstDay set to anything other then 0 (Sunday) it usually gets a offset of -1*firstDay but sometimes events get placed in the correct day but at times they get a offset by 1*firstDay, the behavior in detail is as follows:
Event created in month view (a allday event)
and viewd in month view: misplaced by one day BACKWARDS in time
... agendaWeek view: misplaced by one day BACKWARDS in time
... agendaDay view: misplaced by one day BACKWARDS in time
Event created agendaWeek view (a allDay event)
... month view: misplaced by one day BACKWARDS in time
... agendaWeek view: misplaced by one day BACKWARDS in time
... agendaDay view: misplaced by one day BACKWARDS in time
Event created agendaWeek view (a normal event)
... month view: misplaced by one day BACKWARDS in time
... agendaWeek view: not misplaced, in CORRECT day
... agendaDay view: misplaced by one day BACKWARDS in time
Event created agendaDay view (a allDay event)
... month view: not misplaced, in CORRECT day
... agendaWeek view: not misplaced, in CORRECT day
... agendaDay view: not misplaced, in CORRECT day
Event created agendaDay view (a normal event)
... month view: not misplaced, in CORRECT day
... agendaWeek view: misplaced by one day FORWARD in time
... agendaDay view: not misplaced, in CORRECT day
Not using anything other then month, week and day view so don't know about other views.
"By one day" changes to two days if firstDat is set to 2, 3 days if set to 3 and so on.
So basically if I have firstDay set to 1 and create an event on 9.Dec it shows up on 8.Dec.
The actual start and end variables in "select: function(start, end, allDay)" are set to 8.Dec when creating an event on 9.Dec in all cases except when creating events in agendaDay view, then it's 9.Dec.
I'm using AJAX to set and get events.
I think this is a bug in Fullcalendar, at least haven't found a bug in my code yet.
I'm using fullcalendar 1.4.8, jQuery 1.4.4 and jQuery UI 1.8.6.
--GET--
events: function(start, end, callback) {
$.get("/"+user+"/event/", { start: start.getTime()*0.001, end: end.getTime()*0.001 }, function(data){
console.log(data);
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', data);
}, "json");
}
--POST--
select: function(start, end, allDay) {
console.log(start);
console.log(end);
//Which calendar/context is selected
var calendar = $("#calendars input:radio:checked").val()
$.post("/"+user+"/event/",
{type : "add",
title : "dummy_title",
start : start.getTime()*0.001,
end : end.getTime()*0.001,
allDay: allDay,
calendar: calendar.substring(3, calendar.length)},
function(data) {
console.log(data);
$('#calendar').fullCalendar('refetchEvents')
$('#calendar').fullCalendar('unselect');
}, "text");
},
--Partial Fullcalendar--
var firstDay = 1; // 0 = Sunday, 1 = Monday;
//The actual calendar.
var fullcalendar = $('#calendar').fullCalendar({
defaultView: "agendaWeek",
allDaySlot: true,
height: 520,
header: {
left: '',
center: '',
right: ''
},
timeFormat: 'H:mm{ - H:mm}',
axisFormat: 'H:mm',
firstDay: firstDay,
theme: true,
editable: true,
selectable: true,
selectHelper: true,
Any ideas?
Dec 13, 2010
Project Member
#1
althaus.it
Dec 13, 2010
When I switched to 1.4.9 events stopped showing up at all until I changed $('#calendar').fullCalendar('addEventSource', data); to callback(data), but after that the behavior was the same, so back to square one.
Dec 14, 2010
Hmm... dunno... I'm just doing: events: '/this/is/my/feed'; and a refetchEvents after every change.
Dec 16, 2010
Found the problem, I was doing: var start = view.visStart; start.setDate(start.getDate() - start.getDay()); start = start.getTime()*0.001; Int one place, while I should have been doing: var start = new Date(view.visStart); start.setDate(start.getDate() - start.getDay()); start = start.getTime()*0.001; Problem solved.
Dec 17, 2010
Great you found the problem. :)
Dec 26, 2010
(No comment was entered for this change.)
Status:
Done
|
|
| ► Sign in to add a comment |