mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 18:02:34 +00:00
Fix #11050
This commit is contained in:
@@ -40,6 +40,9 @@ class DateRangeRequest extends ApiRequest
|
|||||||
$validator->after(
|
$validator->after(
|
||||||
function (Validator $validator): void {
|
function (Validator $validator): void {
|
||||||
if (!$validator->valid()) {
|
if (!$validator->valid()) {
|
||||||
|
// set null values
|
||||||
|
$this->attributes->set('start', null);
|
||||||
|
$this->attributes->set('end', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$start = $this->getCarbonDate('start')?->startOfDay();
|
$start = $this->getCarbonDate('start')?->startOfDay();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests;
|
namespace FireflyIII\Api\V1\Requests;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
class DateRequest extends ApiRequest
|
class DateRequest extends ApiRequest
|
||||||
@@ -47,7 +48,7 @@ class DateRequest extends ApiRequest
|
|||||||
// if we also have a range, date must be in that range
|
// if we also have a range, date must be in that range
|
||||||
$start = $this->attributes->get('start');
|
$start = $this->attributes->get('start');
|
||||||
$end = $this->attributes->get('end');
|
$end = $this->attributes->get('end');
|
||||||
if ($date && $start && $end && !$date->between($start, $end)) {
|
if ($date instanceOf Carbon && $start instanceOf Carbon && $end instanceOf Carbon && !$date->between($start, $end)) {
|
||||||
$validator->errors()->add('date', (string)trans('validation.between_date'));
|
$validator->errors()->add('date', (string)trans('validation.between_date'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user