wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Selections\Helper;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class GetSeason
|
||||
{
|
||||
public static function load(?array $season, ?string $seasonmode)
|
||||
{
|
||||
if (! \is_array($season) || ! \count($season)) {
|
||||
|
||||
$date = Carbon::now();
|
||||
|
||||
$season = [];
|
||||
if ($seasonmode == 'halfyear') {
|
||||
if ((int) date('m') > 7) {
|
||||
$season[] = (string) $date->format('y').'/'.$date->format('y') + 1;
|
||||
} else {
|
||||
$season[] = (string) $date->format('y') - 1 .'/'.$date->format('y');
|
||||
}
|
||||
} else {
|
||||
$season[] = (string) $date->year;
|
||||
}
|
||||
}
|
||||
|
||||
return $season;
|
||||
}
|
||||
|
||||
public static function active(?string $seasonmode)
|
||||
{
|
||||
|
||||
$date = Carbon::now();
|
||||
|
||||
$active_season = '';
|
||||
if ($seasonmode == 'halfyear') {
|
||||
if ((int) date('m') > 7) {
|
||||
$active_season = (string) $date->format('y').'/'.$date->format('y') + 1;
|
||||
} else {
|
||||
$active_season = (string) $date->format('y') - 1 .'/'.$date->format('y');
|
||||
}
|
||||
} else {
|
||||
$active_season = (string) $date->year;
|
||||
}
|
||||
|
||||
return $active_season;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user