Hi,
I’ve got a lot of function calls inside each so I’ll post them as well.
[code] scheduler.attachEvent(“onEventCreated”, function(id){
//alert(“onEventCreated”);
updateEventDetails(scheduler.getEvent(id));
return true;
});
scheduler.attachEvent("onBeforeEventChanged", function(event, native_event, new_flag, event_old){
//alert("onBeforeEventChanged");
updateEventDetails(event);
addOrUpdateSlotsArray(event, event.id);
updateSlotsElement();
addOrUpdateDaysArray(event);
updateDaysElement();
return true;
});
scheduler.attachEvent("onEventSave",function(id, event, new_flag){
//alert("onEventSave");
updateEventDetails(event);
addOrUpdateSlotsArray(event, id);
updateSlotsElement();
addOrUpdateDaysArray(event);
updateDaysElement();
return true;
});[/code]
The functions which make use of event.start_date and event.end_date are these ones. Thanks for the quick reply! Hope this helps.
[code] function updateEventDetails(event) {
minutes_available = (event.end_date - event.start_date) / (1000 * 60);
slots_with_contingency = Math.floor((minutes_available) / (duration + contingency));
event.preferred_slots = slots_with_contingency;
if (slots_with_contingency.toString() == “1”) {
event.text = slots_with_contingency.toString() + " slot"
}
else {
event.text = slots_with_contingency.toString() + " slots"
}
event.description = getSlotsString(event, slots_with_contingency);
};
function getMinutesString(minutes) {
if (minutes < 10) {
minutesString = “0” + minutes;
}
else
minutesString = minutes;
return minutesString;
};
function getSlotsString(event, slots_with_contingency) {
slots_string = “”;
current_start_time = event.start_date;
current_end_time = event.start_date;
for ( var slot_number = 1; slot_number <= slots_with_contingency; slot_number++ ) {
current_start_time = new Date(event.start_date.getTime() + ((duration + contingency) * (slot_number - 1) * 60000));
current_end_time = new Date(event.start_date.getTime() + (((duration * slot_number) + (contingency * (slot_number -1))) * 60000));
if (slots_string.length != 0)
slots_string = slots_string + ", ";
slots_string = slots_string + current_start_time.getHours() + “:” + getMinutesString(current_start_time.getMinutes()) + " - " + current_end_time.getHours() + “:” + getMinutesString(current_end_time.getMinutes());
}
return slots_string;
};
function addOrUpdateDaysArray(event) {
date = $.datepicker.formatDate(‘dd/mm/yy’, event.start_date).toString();
if ( isInArray(days_array, date) == false) {
days_array.push(date);
}
date = $.datepicker.formatDate(‘dd/mm/yy’, event.end_date).toString();
if ( isInArray(days_array, date) == false) {
days_array.push(date);
}
};[/code]
It’s weird though since I placed the alert messages there to know if the error occurs once it’s inside on of the callbacks. But what happened is with the alerts popping up the error didn’t happen. I’ll do some more testing to give you more information on the issue.