fixed weekStart bug

This commit is contained in:
Adam Shaw 2009-05-25 17:26:13 +00:00
parent d9fad7a2a7
commit 05a4a07073
2 changed files with 27 additions and 6 deletions

View file

@ -33,14 +33,14 @@
start: "2009-05-18" start: "2009-05-18"
});*/ });*/
$('#calendar').fullCalendar("removeEvent", 3); //$('#calendar').fullCalendar("removeEvent", 3);
/*var events = $('#calendar').fullCalendar('getEventsById', 2); var events = $('#calendar').fullCalendar('getEventsById', 2);
var ev1 = events[0]; var ev1 = events[0];
ev1.title = "yo"; ev1.title = "yo";
ev1.start = '2009-05-14'; ev1.start = '2009-05-14';
ev1.end = '2009-05-16'; ev1.end = '2009-05-16';
$('#calendar').fullCalendar('updateEvent', ev1);*/ $('#calendar').fullCalendar('updateEvent', ev1);
}); });
@ -79,8 +79,7 @@
end: new Date(y, m, 29), end: new Date(y, m, 29),
url: "http://facebook.com/" url: "http://facebook.com/"
} }
], ]
rightToLeft: false
}); });
}); });

View file

@ -108,6 +108,8 @@
gotoMonth: gotoMonth, gotoMonth: gotoMonth,
refresh: updateMonth, refresh: updateMonth,
// event crud
addEvent: function(event) { addEvent: function(event) {
events.push(normalizeEvent(event)); events.push(normalizeEvent(event));
clearEvents(); clearEvents();
@ -173,6 +175,26 @@
} }
} }
return res; return res;
},
// event source crud
addEventSource: function(src) {
eventSources.push(src);
clearEvents();
renderEvents();
},
removeEventSource: function(src) {
var newSources = [];
for (var i=0; i<eventSources.length; i++) {
if (src !== eventSources[i]) {
newSources.push(eventSources[i]);
}
}
eventSources = newSources;
clearEvents();
renderEvents();
} }
}); });
@ -236,7 +258,7 @@
clearTime(date); clearTime(date);
start = cloneDate(date); start = cloneDate(date);
addDays(start, -start.getDay() + weekStart); addDays(start, -((start.getDay() - weekStart + 7) % 7));
end = cloneDate(date); end = cloneDate(date);
addMonths(end, 1); addMonths(end, 1);
addDays(end, (7 - end.getDay() + weekStart) % 7); addDays(end, (7 - end.getDay() + weekStart) % 7);