addMarkedTimespan, then invert or delete partially

I have this requirement, where I’d have to start off with a full day that is blocked out.

Then, querying from the database, I will know which timeslots are actually available, so that I can “unblock” these timeslots within the day, so they can be opened up to add events.

What I did was the following:

// First blocks out the whole day
scheduler.addMarkedTimespan({  
                        days: date_from.toDate(),
                        zones:'fullday',
                        type: "dhx_time_block"
                    });

// Then I start unblocking each available timeslots I got from the DB.  I tried several things:

// Method 1
                    scheduler.addMarkedTimespan({  
                            start_date: new Date('2011-01-01 16:00:00'),
                            end_date: new Date('2011-01-01 16:30:00'),
                            invert_zones: true
                        });

// Method 2
                scheduler.deleteMarkedTimespan({
                    start_date: new Date('2011-01-01 16:00:00'),
                    end_date: new Date('2011-01-01 16:30:00'),
                });

However, they just don’t work for some reason. Am I misunderstanding the original concept, or misusing it somehow?

If so, how should I achieve what I want to do?

Would be grateful if someone could help me on this.

Thanks!

Cheers,
Thomas

Hi,
when you use scheduler.deleteMarkedTimespan, make sure you specify the same ‘type’ that has been used in scheduler.addMarkedTimespan of the target area
e.g.

scheduler.addMarkedTimespan({ days: new Date(2014, 7, 6), zones: "fullday", type: "dhx_time_block" }); //--> scheduler.deleteMarkedTimespan({ start_date: new Date(2014, 7, 6, 10), end_date: new Date(2014, 7, 6, 12), type: "dhx_time_block" });