Skip to content

Commit

Permalink
fix end of month bug in calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarzin committed Oct 31, 2024
1 parent 0ae0ebf commit c88e54d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c88e54d

Please sign in to comment.