Add april fools stuff

This commit is contained in:
Roscoe 2026-03-31 23:15:31 +01:00
commit e37c663c43
Signed by: RoscoeDaWah
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
9 changed files with 194 additions and 22 deletions

View file

@ -17,13 +17,16 @@ public function __construct() {}
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string {
$event = '';
if ($this->isItChristmas()) $event = 'christmas';
if ($this->isItAprilFools()) $event = 'april-fools';
if (isLegacy()) {
return view('components.layout-legacy', [
'isChristmas' => $this->isItChristmas()
'event' => $event
]);
} else {
return view('components.layout', [
'isChristmas' => $this->isItChristmas()
'event' => $event
]);
}
}
@ -37,4 +40,15 @@ public function isItChristmas() : bool {
return $currentDate >= $startDate && $currentDate < $endDate;
}
public function isItAprilFools() : bool {
$currentDate = new DateTime();
$currentDate->setTime(0, 0);
$currentYear = intval($currentDate->format('Y'));
$aprilFools = new DateTime("$currentYear-04-01");
return $currentDate == $aprilFools;
}
}