Skip to content

Firefly III: a personal finances manager

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

James Cole5a23b95352aa
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 1018b784e0..fe83828573 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -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 . '"');
}