Final fix for #170. Now to make a new release!

This commit is contained in:
James Cole 2016-02-05 07:21:51 +01:00
parent 6f9675b6d6
commit 5a23b95352

View File

@ -232,7 +232,7 @@ class Navigation
return $date;
}
if ($repeatFreq === 'custom') {
return $theDate; // the date is already at the start.
return $date; // the date is already at the start.
}
@ -283,6 +283,18 @@ class Navigation
return $date;
}
// a custom range requires the session start
// and session end to calculate the difference in days.
// this is then subtracted from $theDate (* $subtract).
if($repeatFreq === 'custom') {
/** @var Carbon $tStart */
$tStart = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $tEnd */
$tEnd = session('end', Carbon::now()->endOfMonth());
$diffInDays = $tStart->diffInDays($tEnd);
$date->subDays($diffInDays * $subtract);
return $date;
}
throw new FireflyException('Cannot do subtractPeriod for $repeat_freq "' . $repeatFreq . '"');
}