mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add basic catch for big date ranges.
This commit is contained in:
parent
636b3921fa
commit
609edb9dff
@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests\Data;
|
namespace FireflyIII\Api\V1\Requests\Data;
|
||||||
|
|
||||||
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Support\Request\ChecksLogin;
|
use FireflyIII\Support\Request\ChecksLogin;
|
||||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
@ -43,9 +44,15 @@ class DateRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
|
$start = $this->getCarbonDate('start');
|
||||||
|
$end = $this->getCarbonDate('end');
|
||||||
|
if($start->diffInYears($end) > 5) {
|
||||||
|
throw new FireflyException('Date range out of range.');
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'start' => $this->getCarbonDate('start'),
|
'start' => $start,
|
||||||
'end' => $this->getCarbonDate('end'),
|
'end' => $end,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user