Hello everyone, for some reason I cant get my events to have start and end on them except for the first event that shows during recurrence. Does anyone have any idea why this is so? I have a working example that shows what I'm talking about.
A:
All the events have the same end date of Aug 6th.. So the events are:
Aug 2nd - Aug 6th (Ok.. Displays a 5 day event)
Aug 9nd - Aug 6th (End Date is before the start Date, displays one day on the start date)
Aug 16nd - Aug 6th (End Date is before the start Date, displays one day on the start date)
Aug 23nd - Aug 6th (End Date is before the start Date, displays one day on the start date)
Aug 30nd - Aug 6th (End Date is before the start Date, displays one day on the start date)
If you add an alert inside your meeting loop you can see the end date that is being added.
while (meeting <= end) {
events.push({
id: 2,
title: "Monday Meeting",
start: new Date(meeting.valueOf()),
end: endmeeting,
allDay: false
});
<b>alert(endmeeting);</>
// increase by one week
meeting.setDate(meeting.getDate() + 7);
}
Jake1164
2010-08-04 14:42:08
@ Jake1164 -- right, I see and understand that but how would I make it so the following weeks would show accordingly?eg: Aug 2 -6Aug 9-13Aug 16-20 ... etc.
hersh
2010-08-04 14:58:33
+2
A:
Here is how to make each event 5 days long.
while (meeting <= end) {
var d = new Date();
d.setDate(meeting.getDate() + 4);
events.push({
id: 2,
title: "Monday Meeting",
start: new Date(meeting.valueOf()),
end: d,
allDay: false
});
// increase by one week
meeting.setDate(meeting.getDate() + 7);
}
Jake1164
2010-08-04 15:31:30
@ Jake 1164 -- thanks for helping me get this far. Now my question is, what if they select 3 day event or maybe even longer like 10 day event, is there a way to automatically calcuate it instead of manually counting?
hersh
2010-08-04 15:41:12
Guess it all depends on where the events are coming from. I tend to store mine in a database and access them via a webservice. I have a new event entry page and when they want a 3 day event it stores the start and end dates.
Jake1164
2010-08-04 16:02:39
@Jake1164 -- thanks again, I've found what I was looking for regarding getting number of days between two dates and was able to get my "end" date to show by implementing what you showed.
hersh
2010-08-04 18:34:05