Skip to content

Commit

Permalink
Merge pull request #208 from dbarzin/dev
Browse files Browse the repository at this point in the history
fix end of month bug in calendar
  • Loading branch information
dbarzin authored Oct 31, 2024
2 parents 317ee94 + c88e54d commit a308fe7
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 a308fe7

Please sign in to comment.