mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-25 02:10:22 -06:00
Fix date requests
This commit is contained in:
parent
6d4004d1ed
commit
d118c0d886
@ -46,6 +46,8 @@ class DateRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
$start = $this->getCarbonDate('start');
|
$start = $this->getCarbonDate('start');
|
||||||
$end = $this->getCarbonDate('end');
|
$end = $this->getCarbonDate('end');
|
||||||
|
$start->startOfDay();
|
||||||
|
$end->endOfDay();
|
||||||
if ($start->diffInYears($end, true) > 5) {
|
if ($start->diffInYears($end, true) > 5) {
|
||||||
throw new FireflyException('Date range out of range.');
|
throw new FireflyException('Date range out of range.');
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class DateRequest extends FormRequest
|
|||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => $this->getCarbonDate('start'),
|
'start' => $this->getCarbonDate('start')->startOfDay(),
|
||||||
'end' => $this->getCarbonDate('end')->endOfDay(),
|
'end' => $this->getCarbonDate('end')->endOfDay(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -437,15 +437,17 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
}
|
}
|
||||||
// find the most recent date for this bill NOT in the future. Cache this date:
|
// find the most recent date for this bill NOT in the future. Cache this date:
|
||||||
$start = clone $bill->date;
|
$start = clone $bill->date;
|
||||||
|
$start->startOfDay();
|
||||||
app('log')->debug('nextExpectedMatch: Start is '.$start->format('Y-m-d'));
|
app('log')->debug('nextExpectedMatch: Start is '.$start->format('Y-m-d'));
|
||||||
|
|
||||||
while ($start < $date) {
|
while ($start < $date) {
|
||||||
app('log')->debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d'), $date->format('Y-m-d')));
|
app('log')->debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d H:i:s'), $date->format('Y-m-d H:i:s')));
|
||||||
$start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
|
$start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
|
||||||
app('log')->debug('Start is now '.$start->format('Y-m-d'));
|
app('log')->debug('Start is now '.$start->format('Y-m-d H:i:s'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
|
$end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
|
||||||
|
$end->endOfDay();
|
||||||
|
|
||||||
// see if the bill was paid in this period.
|
// see if the bill was paid in this period.
|
||||||
$journalCount = $bill->transactionJournals()->before($end)->after($start)->count();
|
$journalCount = $bill->transactionJournals()->before($end)->after($start)->count();
|
||||||
|
Loading…
Reference in New Issue
Block a user