datepicker shortcut issue fixed

This commit is contained in:
Cihan Şentürk 2024-10-16 21:19:41 +03:00 committed by GitHub
parent 3fdc71b3ca
commit 70f96d4fc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -56,13 +56,12 @@ trait DateTime
public function getFinancialStart($year = null): Date
{
$start_of_year = Date::now()->startOfYear();
$start_date = request()->filled('start_date') ? Date::parse(request('start_date')) : null;
$setting = explode('-', setting('localisation.financial_start'));
$day = ! empty($setting[0]) ? $setting[0] : (! empty($start_date) ? $start_date->day : $start_of_year->day);
$month = ! empty($setting[1]) ? $setting[1] : (! empty($start_date) ? $start_date->month : $start_of_year->month);
$year = $year ?? (! empty($start_date) ? $start_date->year : $start_of_year->year);
$day = ! empty($setting[0]) ? $setting[0] : $start_of_year->day;
$month = ! empty($setting[1]) ? $setting[1] : $start_of_year->month;
$year = $year ?? $start_of_year->year;
$financial_start = Date::create($year, $month, $day);
@ -365,4 +364,4 @@ trait DateTime
{
return $this->scopeDateFilter($query, $field);
}
}
}