Invalid event_length's when creating events

When creating events with recurring dates, the system will use “end_date” to signify when the last event will occur. E.g. “daily untill 2013-01-01” will have end_date = 2013-01-01 00:00:00.

As I understand it, you use “event_length” to signify how long the event should be. Such that using start_date together with event_length can tell the system from time/to time.

The problem I’m experiencing, is that event_length is too big when manually posting the data to the server. It looks like the problem is that it’s calculated after end_date is set to “9999-02-01”.

Im currently posting the event to the server with a onEventAdded handler. So at the point, event_length is already “big” (I’ve inspected the event argument that is passed to these handlers with console.log(), and there’s just no information about the “end date” the user had selected, so there’s no way to find out the to-time, i.e. duration of each event.)

PS. The server-side controller is not the one that comes with dhtmlxscheduler, if that has anything to do with it.

event_length can have two different meaning

for recurring event it stores the length of event in seconds which must be relative small numbers (86400 for one day), but for exceptions on recurring events ( one instance which behaves differently from main event ) it holds a timestamp of modified instance, which may be quite a big number (can be handled by DB:int type )

Do you have a life demo page where it can be checked?

Sorry, the page is internal only, so I can’t really show it to you. I might produce one if I can’t get it to work, but I’ll try some more first…

Regarding the problem, this happens on newly created events. E.g. I drag the mouse from 8am to 10am on an empty spot, choose daily -> every 1 day and press Save. My onEventAdded will get an event with a very big event_length, and as far as I can see, the fact that I chose 10am is not found anywhere in the object when inspecting it (unless it’s encoded into event_length somehow.)

When I then update my page and get the newly created event, it doesn’t show at all. It will show up as a normal event going from 8am on that day into infinity (i.e. just as if I’d created a normal event from 8am to 9999-02-01 00:00:00.)

If I update the database by setting event_length to, say 7200, I get the exact effect that I want. The event will reoccur every 1 day, for 2 hours, starting at 8am.

If I understand you correctly, event_length will only get that big if I edit a particular instance of a recurring event. Since I’m creating a new one, that shouldn’t happen. Maybe there’s a problem with how I’m opening my “Create Event” window, or perhaps something in the custom fields, that confuses the recurring extension to think I’m editing an instance of an already created recurring event. Will have to check my code tomorrow.

But if there’s anything obvious that could cause this, please tell, so I can look more efficiently :slight_smile:

I’ve found the problem. The recurring lightbox section seems to be dependant on being ordered before the time. We just added it to the bottom of our list, but as soon as I put it above the time, it worked.

Just so there’s no confusion:

// Doesn't work. scheduler.config.lightbox.sections = [ {...}, {...}, {.. type: 'time' ..}, { .. type: 'recurring' .. }];

// Works! scheduler.config.lightbox.sections = [ {...}, {...}, { .. type: 'recurring' .. }, {.. type: 'time' ..}];

You are correct, the recurring section works correctly only when it placed before the time section , for now this is mandatory requirement.