Jiskla
October 9, 2012, 8:12am
#1
Hi,
I have to implement the scheduler for an arabic school and their week starts on Saturday.
I was able to get it to work for the week view, but now i recognized that the “forward & backward arrows” are not working correcty.
For first, I would like to know if I did it correct, by using the following for initialization:
...
scheduler.config.start_on_monday = false;
scheduler.date.week_start = function(date){
return scheduler.date.add(date, 5, "day");
}
...
By clicking forward it goes 12 days forward.
Clicking backwards it goes 2 days back.
Is it a bug or is there something I could do about it?
Thanks
Your are going in correct direction, but above code do not produce valid result. It must look similar to next
scheduler.date.week_start = function(date){
var shift=date.getDay();
if (shift >= 5) shift-=5;
else shift+=2;
return this.date_part(this.add(date,-1*shift,"day"));
}
week_start method must convert any date to nearest saturday
Jiskla
October 9, 2012, 2:50pm
#3
Thank you very much for that information!
Now it´s working like a charm.
if the start day is a variable say var weekstart = 4(thursday), then how this function should look like ?
Polina
April 29, 2016, 2:22pm
#5
Something like that:
scheduler.date.week_start = function(date){
var shift=date.getDay();
if (shift >= 4) shift-=4;
else shift+=3;
return this.date_part(this.add(date,-1*shift,"day"));
}