Skip to content

Firefly III: a personal finances manager

Added magic words "currentMonthEnd" and "currentMonthStart".

James Colef5cbed7c0cb7
diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php
index db75e43d18..08089fc103 100644
--- a/app/Support/Binder/Date.php
+++ b/app/Support/Binder/Date.php
@@ -32,6 +32,14 @@ class Date implements BinderInterface
*/
public static function routeBinder($value, $route)
{
+ if($value === 'currentMonthStart') {
+ return Carbon::now()->startOfMonth();
+ }
+ if($value === 'currentMonthEnd') {
+ return Carbon::now()->endOfMonth();
+ }
+
+
try {
$date = new Carbon($value);
} catch (Exception $e) {
@@ -41,4 +49,4 @@ class Date implements BinderInterface
return $date;
}
-}
\ No newline at end of file
+}
diff --git a/resources/views/reports/index.twig b/resources/views/reports/index.twig
index d27cca0e24..83e38c4f56 100644
--- a/resources/views/reports/index.twig
+++ b/resources/views/reports/index.twig
@@ -95,8 +95,8 @@
<li>
<a href="{{ route('reports.report',
['default',
- startOfMonth.format('Ymd'),
- endOfMonth.format('Ymd'),
+ 'currentMonthStart',
+ 'currentMonthEnd',
accountList
]) }}">{{ 'report_this_month_quick'|_ }}</a>
</li>