mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 10:53:31 +00:00
Fix tests
This commit is contained in:
@@ -464,14 +464,15 @@ class Navigation
|
|||||||
$increment = 'addDay';
|
$increment = 'addDay';
|
||||||
$format = $this->preferredCarbonFormat($start, $end);
|
$format = $this->preferredCarbonFormat($start, $end);
|
||||||
$displayFormat = (string)trans('config.month_and_day_js', [], $locale);
|
$displayFormat = (string)trans('config.month_and_day_js', [], $locale);
|
||||||
|
$diff = $start->diffInMonths($end, true);
|
||||||
// increment by month (for year)
|
// increment by month (for year)
|
||||||
if ($start->diffInMonths($end, true) > 1.0) {
|
if ($diff >= 1.0001) {
|
||||||
$increment = 'addMonth';
|
$increment = 'addMonth';
|
||||||
$displayFormat = (string)trans('config.month_js');
|
$displayFormat = (string)trans('config.month_js');
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment by year (for multi-year)
|
// increment by year (for multi-year)
|
||||||
if ($start->diffInMonths($end, true) > 12.0) {
|
if ($diff >= 12.0001) {
|
||||||
$increment = 'addYear';
|
$increment = 'addYear';
|
||||||
$displayFormat = (string)trans('config.year_js');
|
$displayFormat = (string)trans('config.year_js');
|
||||||
}
|
}
|
||||||
@@ -494,11 +495,15 @@ class Navigation
|
|||||||
public function preferredCarbonFormat(Carbon $start, Carbon $end): string
|
public function preferredCarbonFormat(Carbon $start, Carbon $end): string
|
||||||
{
|
{
|
||||||
$format = 'Y-m-d';
|
$format = 'Y-m-d';
|
||||||
if ($start->diffInMonths($end, true) > 1.0) {
|
$diff = $start->diffInMonths($end, true);
|
||||||
|
Log::debug(sprintf('preferredCarbonFormat(%s, %s) = %f', $start->format('Y-m-d'), $end->format('Y-m-d'), $diff));
|
||||||
|
if ($diff >= 1.001) {
|
||||||
|
Log::debug(sprintf('Return Y-m because %s', $diff));
|
||||||
$format = 'Y-m';
|
$format = 'Y-m';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($start->diffInMonths($end, true) > 12.0) {
|
if ($diff >= 12.001) {
|
||||||
|
Log::debug(sprintf('Return Y because %s', $diff));
|
||||||
$format = 'Y';
|
$format = 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user