Get blocked time for a specific date

Hello,

We are using addMarkedTimestamp to add blocking for every day of week: monday, tuesday, etc …

Example:

scheduler.addMarkedTimespan({ days: 1, // every monday zones: [0, 600, 1000, 1440], css: "unavailable-time", sections: { Resource = "123" } });

Now we would like to determine, which time is blocked on a specific date, something like this:

[code]scheduler.getMarkedTimespanForDate({
days: new Date(2015, 10, 12), // Monday, 2015-10-12
sections: { Resource = “123” }
});

// should return [0, 600, 1000, 1440][/code]

How can we do this with scheduler?

Hello.

Unfortunately, currently scheduler doesn’t have such api.
But you could get it from scheduler._marked_timespans object.
For example if you want to get marked (not blocked) times for specific date, for specific resource on timeline you could use something like this:

var timelineName = "timeline",
    resouce = "2",
    date = new Date(2012,7,6);

var marks = scheduler._marked_timespans[timelineName][resouce];
if(marks)
{
	//For common marks
	var day = date.getDay();
	if(marks[day] && marks[day].default){
		var sections = marks[day].default;
		for(var i = 0; i < sections.length; i++){
			console.log(sections[i].zones)
		}
	}

	//For specific marks
	var time = date.valueOf();

	if(marks[time] && marks[time].default){
		var sections = marks[time].default;
		for(var i = 0; i < sections.length; i++){
			console.log(sections[i].zones)
		}
	}
}