mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-21 00:50:07 +00:00
This commit is contained in:
@@ -9,11 +9,13 @@ use FireflyIII\Rules\IsBoolean;
|
|||||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||||
use FireflyIII\Rules\UniqueAccountNumber;
|
use FireflyIII\Rules\UniqueAccountNumber;
|
||||||
use FireflyIII\Rules\UniqueIban;
|
use FireflyIII\Rules\UniqueIban;
|
||||||
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use LaravelJsonApi\Laravel\Http\Requests\ResourceRequest;
|
use LaravelJsonApi\Laravel\Http\Requests\ResourceRequest;
|
||||||
|
|
||||||
class AccountRequest extends ResourceRequest
|
class AccountRequest extends ResourceRequest
|
||||||
{
|
{
|
||||||
|
use ConvertsDataTypes;
|
||||||
/**
|
/**
|
||||||
* Get the validation rules for the resource.
|
* Get the validation rules for the resource.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,9 +41,8 @@ trait DateCalculation
|
|||||||
{
|
{
|
||||||
$difference = (int)($start->diffInDays($end, true) + 1);
|
$difference = (int)($start->diffInDays($end, true) + 1);
|
||||||
$today = today(config('app.timezone'))->startOfDay();
|
$today = today(config('app.timezone'))->startOfDay();
|
||||||
|
|
||||||
if ($start->lte($today) && $end->gte($today)) {
|
if ($start->lte($today) && $end->gte($today)) {
|
||||||
$difference = $today->diffInDays($end);
|
$difference = $today->diffInDays($end) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)(0 === $difference ? 1 : $difference);
|
return (int)(0 === $difference ? 1 : $difference);
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ trait GetConfigurationData
|
|||||||
|
|
||||||
/** @var Carbon $todayEnd */
|
/** @var Carbon $todayEnd */
|
||||||
$todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
|
$todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
|
||||||
|
|
||||||
|
|
||||||
if ($todayStart->ne($start) || $todayEnd->ne($end)) {
|
if ($todayStart->ne($start) || $todayEnd->ne($end)) {
|
||||||
$ranges[ucfirst((string)trans('firefly.today'))] = [$todayStart, $todayEnd];
|
$ranges[ucfirst((string)trans('firefly.today'))] = [$todayStart, $todayEnd];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ class Navigation
|
|||||||
'year' => 'startOfYear',
|
'year' => 'startOfYear',
|
||||||
'yearly' => 'startOfYear',
|
'yearly' => 'startOfYear',
|
||||||
'1Y' => 'startOfYear',
|
'1Y' => 'startOfYear',
|
||||||
|
'MTD' => 'startOfMonth',
|
||||||
];
|
];
|
||||||
|
|
||||||
$parameterMap = [
|
$parameterMap = [
|
||||||
@@ -281,6 +282,13 @@ class Navigation
|
|||||||
|
|
||||||
return $currentEnd;
|
return $currentEnd;
|
||||||
}
|
}
|
||||||
|
if('MTD' === $repeatFreq) {
|
||||||
|
$today = today();
|
||||||
|
if($today->isSameMonth($end)) {
|
||||||
|
return $today->endOfDay();
|
||||||
|
}
|
||||||
|
return $end->endOfMonth();
|
||||||
|
}
|
||||||
|
|
||||||
$result = match ($repeatFreq) {
|
$result = match ($repeatFreq) {
|
||||||
'last7' => $currentEnd->addDays(7)->startOfDay(),
|
'last7' => $currentEnd->addDays(7)->startOfDay(),
|
||||||
|
|||||||
Reference in New Issue
Block a user