It's the little things. Fixed #3050

This commit is contained in:
James Cole
2020-01-25 23:29:26 +01:00
parent bf07859718
commit a381dc1cfe

View File

@@ -117,13 +117,12 @@ class Navigation
* Start looping per month for 1 year + the rest of the year: * Start looping per month for 1 year + the rest of the year:
*/ */
$perMonthEnd = clone $end; $perMonthEnd = clone $end;
$perMonthStart = clone $end; $perMonthStart = clone $start;
$perMonthStart->startOfYear()->subYear(); $perMonthStart->startOfYear()->subYear();
$perMonthStart = $start->lt($perMonthStart) ? $perMonthStart : $start; $perMonthStart = $start->lt($perMonthStart) ? $perMonthStart : $start;
// loop first set: // loop first set:
while ($perMonthEnd >= $perMonthStart) { while ($perMonthEnd >= $perMonthStart) {
$perMonthEnd = $this->startOfPeriod($perMonthEnd, $range); $perMonthEnd = $this->startOfPeriod($perMonthStart, $range);
$currentEnd = $this->endOfPeriod($perMonthEnd, $range); $currentEnd = $this->endOfPeriod($perMonthEnd, $range);
if ($currentEnd->gt($start)) { if ($currentEnd->gt($start)) {
$periods[] = [ $periods[] = [
@@ -134,7 +133,6 @@ class Navigation
} }
$perMonthEnd = $this->subtractPeriod($perMonthEnd, $range, 1); $perMonthEnd = $this->subtractPeriod($perMonthEnd, $range, 1);
} }
// do not continue if date is already less // do not continue if date is already less
if ($perMonthEnd->lt($start)) { if ($perMonthEnd->lt($start)) {
return $periods; return $periods;
@@ -317,6 +315,7 @@ class Navigation
$entries[$formatted] = $displayed; $entries[$formatted] = $displayed;
$begin->$increment(); $begin->$increment();
} }
return $entries; return $entries;
} }
@@ -590,6 +589,7 @@ class Navigation
//Log::debug(sprintf('repeatFreq is %s, start is %s and end is %s (session data).', $repeatFreq, $tStart->format('Y-m-d'), $tEnd->format('Y-m-d'))); //Log::debug(sprintf('repeatFreq is %s, start is %s and end is %s (session data).', $repeatFreq, $tStart->format('Y-m-d'), $tEnd->format('Y-m-d')));
//Log::debug(sprintf('Diff in days is %d', $diffInDays)); //Log::debug(sprintf('Diff in days is %d', $diffInDays));
$date->subDays($diffInDays * $subtract); $date->subDays($diffInDays * $subtract);
//Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d'))); //Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d')));
return $date; return $date;