mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Fix various code.
This commit is contained in:
@@ -421,7 +421,7 @@ class Navigation
|
||||
$currentEnd->{$function}(); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
if (null !== $maxDate && $currentEnd > $maxDate) {
|
||||
if ($maxDate instanceof Carbon && $currentEnd > $maxDate) {
|
||||
return clone $maxDate;
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ class Navigation
|
||||
|
||||
if ($diff >= 12.001) {
|
||||
// Log::debug(sprintf('Return Y because %s', $diff));
|
||||
$format = 'Y';
|
||||
return 'Y';
|
||||
}
|
||||
|
||||
return $format;
|
||||
@@ -565,16 +565,15 @@ class Navigation
|
||||
public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string
|
||||
{
|
||||
$locale = app('steam')->getLocale();
|
||||
$format = (string) trans('config.month_and_day_js', [], $locale);
|
||||
if ($start->diffInMonths($end, true) > 1) {
|
||||
$format = (string) trans('config.month_js', [], $locale);
|
||||
return (string) trans('config.month_js', [], $locale);
|
||||
}
|
||||
|
||||
if ($start->diffInMonths($end, true) > 12) {
|
||||
$format = (string) trans('config.year_js', [], $locale);
|
||||
return (string) trans('config.year_js', [], $locale);
|
||||
}
|
||||
|
||||
return $format;
|
||||
return (string) trans('config.month_and_day_js', [], $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -583,16 +582,15 @@ class Navigation
|
||||
*/
|
||||
public function preferredEndOfPeriod(Carbon $start, Carbon $end): string
|
||||
{
|
||||
$format = 'endOfDay';
|
||||
if ((int) $start->diffInMonths($end, true) > 1) {
|
||||
$format = 'endOfMonth';
|
||||
return 'endOfMonth';
|
||||
}
|
||||
|
||||
if ((int) $start->diffInMonths($end, true) > 12) {
|
||||
$format = 'endOfYear';
|
||||
return 'endOfYear';
|
||||
}
|
||||
|
||||
return $format;
|
||||
return 'endOfDay';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,16 +599,15 @@ class Navigation
|
||||
*/
|
||||
public function preferredRangeFormat(Carbon $start, Carbon $end): string
|
||||
{
|
||||
$format = '1D';
|
||||
if ((int) $start->diffInMonths($end, true) > 1) {
|
||||
$format = '1M';
|
||||
return '1M';
|
||||
}
|
||||
|
||||
if ((int) $start->diffInMonths($end, true) > 12) {
|
||||
$format = '1Y';
|
||||
return '1Y';
|
||||
}
|
||||
|
||||
return $format;
|
||||
return '1D';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -619,16 +616,15 @@ class Navigation
|
||||
*/
|
||||
public function preferredSqlFormat(Carbon $start, Carbon $end): string
|
||||
{
|
||||
$format = '%Y-%m-%d';
|
||||
if ((int) $start->diffInMonths($end, true) > 1) {
|
||||
$format = '%Y-%m';
|
||||
return '%Y-%m';
|
||||
}
|
||||
|
||||
if ((int) $start->diffInMonths($end, true) > 12) {
|
||||
$format = '%Y';
|
||||
return '%Y';
|
||||
}
|
||||
|
||||
return $format;
|
||||
return '%Y-%m-%d';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user