Fix month-naming for different week arrangements

fixes #7179
This commit is contained in:
Matthias Jentsch 2014-09-12 11:50:51 +02:00
parent 6c3c466f92
commit 1932a912f8
1 changed files with 10 additions and 1 deletions

View File

@ -239,9 +239,12 @@ class HistoryColorGrid extends AbstractWidget {
if ($weekday > 6) { if ($weekday > 6) {
$weekday = 0; $weekday = 0;
$weeks[] = array(); $weeks[] = array();
$week++; // PRESENT => The last day of week determines the month
if ($this->weekFlow === self::CAL_GROW_INTO_PRESENT) {
$months[$week] = $month; $months[$week] = $month;
} }
$week++;
}
if ($day > cal_days_in_month(CAL_GREGORIAN, $month, $year)) { if ($day > cal_days_in_month(CAL_GREGORIAN, $month, $year)) {
$month++; $month++;
if ($month > 12) { if ($month > 12) {
@ -250,6 +253,12 @@ class HistoryColorGrid extends AbstractWidget {
} }
$day = 1; $day = 1;
} }
if ($weekday === 0) {
// PAST => The first day of each week determines the month
if ($this->weekFlow === self::CAL_GROW_INTO_PAST) {
$months[$week] = $month;
}
}
$date = $this->toDateStr($day, $month, $year); $date = $this->toDateStr($day, $month, $year);
$weeks[$week][$weekday] = $date; $weeks[$week][$weekday] = $date;
}; };