Merge pull request #3231 from CihanSenturk/fix-datepicker-shortcut-issue

Datepicker shortcut issue fixed
This commit is contained in:
Cüneyt Şentürk 2024-11-29 11:08:21 +00:00 committed by GitHub
commit 959dbd2ca5
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);
}
}
}