From c88e54d38b523209dadb367a4df46262aedfde21 Mon Sep 17 00:00:00 2001 From: didier Date: Thu, 31 Oct 2024 09:34:32 +0100 Subject: [PATCH] fix end of month bug in calendar --- app/Calendar.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Calendar.php b/app/Calendar.php index ebd5b325..0d78dae2 100644 --- a/app/Calendar.php +++ b/app/Calendar.php @@ -13,12 +13,12 @@ class Calendar private $active_day; private $events = []; - public function __construct($date = null) + public function __construct($dateInput = null) { - $this->date = DateTime::createFromFormat('m/Y', $date)->getTimestamp(); - $this->active_year = $date !== null ? date('Y', $this->date) : date('Y'); - $this->active_month = $date !== null ? date('m', $this->date) : date('m'); - $this->active_day = $date !== null ? date('d', $this->date) : date('d'); + $this->date = DateTime::createFromFormat('d/m/Y', "01/".$dateInput)->getTimestamp(); + $this->active_year = $dateInput !== null ? date('Y', $this->date) : date('Y'); + $this->active_month = $dateInput !== null ? date('m', $this->date) : date('m'); + $this->active_day = $dateInput !== null ? date('d', $this->date) : date('d'); } public function __toString()