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