mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix for #172
This commit is contained in:
parent
7fa93e97db
commit
388d141d82
@ -178,10 +178,13 @@ class ReportHelper implements ReportHelperInterface
|
||||
/** @var FiscalHelperInterface $fiscalHelper */
|
||||
$fiscalHelper = app('FireflyIII\Helpers\FiscalHelperInterface');
|
||||
$start = clone $date;
|
||||
$start->startOfMonth();
|
||||
$end = Carbon::now();
|
||||
$end->endOfMonth();
|
||||
$months = [];
|
||||
|
||||
while ($start <= $end) {
|
||||
// current year:
|
||||
$year = $fiscalHelper->endOfFiscalYear($start)->year;
|
||||
|
||||
if (!isset($months[$year])) {
|
||||
@ -196,6 +199,7 @@ class ReportHelper implements ReportHelperInterface
|
||||
|
||||
$currentEnd = clone $start;
|
||||
$currentEnd->endOfMonth();
|
||||
|
||||
$months[$year]['months'][] = [
|
||||
'formatted' => $start->formatLocalized('%B %Y'),
|
||||
'start' => $start->format('Y-m-d'),
|
||||
@ -203,7 +207,10 @@ class ReportHelper implements ReportHelperInterface
|
||||
'month' => $start->month,
|
||||
'year' => $year,
|
||||
];
|
||||
$start->addMonth();
|
||||
|
||||
// to make the hop to the next month properly:
|
||||
$start = clone $currentEnd;
|
||||
$start->addDay();
|
||||
}
|
||||
|
||||
return $months;
|
||||
|
@ -34,8 +34,8 @@ $(function () {
|
||||
var startStr = readCookie('report-start');
|
||||
var endStr = readCookie('report-end');
|
||||
if (startStr !== null && endStr !== null && startStr.length == 8 && endStr.length == 8) {
|
||||
var startDate = moment(startStr, "YYYYMMDD");
|
||||
var endDate = moment(endStr, "YYYYMMDD");
|
||||
var startDate = moment(startStr, "YYYY-MM-DD");
|
||||
var endDate = moment(endStr, "YYYY-MM-DD");
|
||||
var datePicker = $('#inputDateRange').data('daterangepicker');
|
||||
datePicker.setStartDate(startDate);
|
||||
datePicker.setEndDate(endDate);
|
||||
@ -87,8 +87,8 @@ function preSelectDate(e) {
|
||||
"use strict";
|
||||
var link = $(e.target);
|
||||
var picker = $('#inputDateRange').data('daterangepicker');
|
||||
picker.setStartDate(link.data('start'));
|
||||
picker.setEndDate(link.data('end'));
|
||||
picker.setStartDate(moment(link.data('start'), "YYYY-MM-DD"));
|
||||
picker.setEndDate(moment(link.data('end'), "YYYY-MM-DD"));
|
||||
return false;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user