problems with custom view

Hi, all!
I created a custom view for weekend:

scheduler.date.weekend_start = function(date){
		var next = date;
		next.setDate( date.getDate() - date.getDay() + 6 );
		return next;
}
scheduler.date.get_weekend_end = function(date) {
		return scheduler.date.add(date,2,"day");
}
scheduler.date.add_weekend = function(date,inc){
		return scheduler.date.add(date,inc*7,"day");
}
scheduler.templates.weekend_date = scheduler.templates.week_date;
scheduler.templates.weekend_scale_date = scheduler.templates.week_scale_date;

Apparently, it is working normally, but when I click on the today button this view didn’t work anymore, until refresh the page. There is nothing in console.
Am I doing something wrong?

After click on today button at weekend view, the creation event doesn’t work correctly. Sometimes the lighbox doesn’t open and sometimes it opens with wrong time values.
test.zip (1.62 KB)

Hello,

Make the following change:

scheduler.date.weekend_start = function(date){ var next = new Date(date); next.setDate( date.getDate() - date.getDay() + 6 ); return scheduler.date.date_part(next); }
Best regards,
Ilya

It is working now… Thanks!