diff --git a/app/Http/Controllers/Common/Dashboard.php b/app/Http/Controllers/Common/Dashboard.php index 0091cf9fe..926f6b1b6 100644 --- a/app/Http/Controllers/Common/Dashboard.php +++ b/app/Http/Controllers/Common/Dashboard.php @@ -126,7 +126,6 @@ class Dashboard extends Controller $start = Date::parse(request('start', $this->today->startOfYear()->format('Y-m-d'))); $end = Date::parse(request('end', $this->today->endOfYear()->format('Y-m-d'))); $period = request('period', 'month'); - $range = request('range', 'custom'); $start_month = $start->month; $end_month = $end->month; @@ -137,8 +136,11 @@ class Dashboard extends Controller $s = clone $start; if ($range == 'last_12_months') { - $end_month = 12; - $start_month = 1; + $end_month = 12; + $start_month = 0; + } elseif ($range == 'custom') { + $end_month = $end->diffInMonths($start); + $start_month = 0; } for ($j = $end_month; $j >= $start_month; $j--) {