Replace deprecated method.

This commit is contained in:
James Cole
2022-03-27 20:24:13 +02:00
parent 8ee4c2ea11
commit cbf14f541c
39 changed files with 140 additions and 123 deletions

View File

@@ -187,8 +187,8 @@ class FrontpageChartGenerator
'%s (%s) (%s - %s)',
$budget->name,
$entry['currency_name'],
$limit->start_date->formatLocalized($this->monthAndDayFormat),
$limit->end_date->formatLocalized($this->monthAndDayFormat)
$limit->start_date->isoFormat($this->monthAndDayFormat),
$limit->end_date->isoFormat($this->monthAndDayFormat)
);
}
$sumSpent = bcmul($entry['sum'], '-1'); // spent

View File

@@ -92,7 +92,7 @@ trait ChartGeneration
$previous = array_values($range)[0];
while ($currentStart <= $end) {
$format = $currentStart->format('Y-m-d');
$label = trim($currentStart->formatLocalized((string)trans('config.month_and_day', [], $locale)));
$label = trim($currentStart->isoFormat((string)trans('config.month_and_day_js', [], $locale)));
$balance = $range[$format] ?? $previous;
$previous = $balance;
$currentStart->addDay();

View File

@@ -98,7 +98,7 @@ trait GetConfigurationData
$end = session('end');
/** @var Carbon $first */
$first = session('first');
$title = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat));
$title = sprintf('%s - %s', $start->isoFormat($this->monthAndDayFormat), $end->isoFormat($this->monthAndDayFormat));
$isCustom = true === session('is_custom_range', false);
$today = today(config('app.timezone'));
$ranges = [

View File

@@ -356,7 +356,7 @@ class Navigation
$entries = [];
while ($begin < $end) {
$formatted = $begin->format($format);
$displayed = $begin->formatLocalized($displayFormat);
$displayed = $begin->isoFormat($displayFormat);
$entries[$formatted] = $displayed;
$begin->$increment();
}
@@ -413,7 +413,7 @@ class Navigation
];
if (array_key_exists($repeatFrequency, $formatMap)) {
return $date->formatLocalized((string)$formatMap[$repeatFrequency]);
return $date->isoFormat((string)$formatMap[$repeatFrequency]);
}
if ('3M' === $repeatFrequency || 'quarter' === $repeatFrequency) {
$quarter = ceil($theDate->month / 3);
@@ -440,13 +440,13 @@ class Navigation
public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string
{
$locale = app('steam')->getLocale();
$format = (string)trans('config.month_and_day', [], $locale);
$format = (string)trans('config.month_and_day_js', [], $locale);
if ($start->diffInMonths($end) > 1) {
$format = (string)trans('config.month', [], $locale);
$format = (string)trans('config.month_js', [], $locale);
}
if ($start->diffInMonths($end) > 12) {
$format = (string)trans('config.year', [], $locale);
$format = (string)trans('config.year_js', [], $locale);
}
return $format;

View File

@@ -369,7 +369,7 @@ class General extends AbstractExtension
function (string $date, string $format): string {
$carbon = new Carbon($date);
return $carbon->formatLocalized($format);
return $carbon->isoFormat($format);
}
);
}