This commit is contained in:
denisdulici
2018-12-31 14:41:17 +03:00
parent a702d1ccba
commit 09366fa243
11 changed files with 85 additions and 26 deletions

View File

@ -31,7 +31,7 @@ trait DateTime
$end = Date::parse($year . '-12-31')->format('Y-m-d');
// check if financial year has been customized
$financial_start = Date::parse(setting('general.financial_start'));
$financial_start = $this->getFinancialStart();
if (Date::now()->startOfYear()->format('Y-m-d') !== $financial_start->format('Y-m-d')) {
if (!is_null(request('year'))) {
@ -82,4 +82,16 @@ trait DateTime
return $groups;
}
public function getFinancialStart()
{
$now = Date::now()->startOfYear();
$setting = explode('-', setting('general.financial_start'));
$day = !empty($setting[0]) ? $setting[0] : $now->day;
$month = !empty($setting[1]) ? $setting[1] : $now->month;
return Date::create(null, $month, $day);
}
}