- assigned_to: nobody --> amekkawi
In week view, when using week_start of Monday and the
current day is a Sunday, the next week gets displayed
instead of the current week.
Problem is in the initialization code in main.php lines
97-100.
Currently has:
// when does this particular week start and end?
$dow =
Day_of_Week($showdate['month'],$showdate['day'],$showdate['year']);
$weekfrom =
Add_Delta_Days($showdate['month'],$showdate['day'],$showdate['year'],-$dow+$week_start);
//if $week_start is 1 we get Monday as week's start
$weekto =
Add_Delta_Days($showdate['month'],$showdate['day'],$showdate['year'],6-$dow+$week_start);
//if $week_start is 1 we get Sunday week's end
Probably should be:
// when does this particular week start and end?
$dow =
Day_of_Week($showdate['month'],$showdate['day'],$showdate['year']);
if($week_start == 1 && $dow == 0){
$week_correction1=7;
}else{
$week_correction1=0;
}
$weekfrom =
Add_Delta_Days($showdate['month'],$showdate['day'],$showdate['year'],-$dow+$week_start-$week_correction1);
//if $week_start is 1 we get Monday as week's start
$weekto =
Add_Delta_Days($showdate['month'],$showdate['day'],$showdate['year'],6-$dow+$week_start-$week_correction1);
//if $week_start is 1 we get Sunday week's end
A correction factor needs to be applied to the week
determination just like the correction appplied when
determining the month.
This seems to fix the Week View mode and also then the
previous and next navigation links which were not
correct when the first day of the month is a Sunday and
calendar is to display starting on a Monday. It would
take two clicks on previous to get back to the previous
week in this case.