diff --git a/Datatypes/SmartDateTime.php b/Datatypes/SmartDateTime.php index aaeb2a0c9..952ee9914 100644 --- a/Datatypes/SmartDateTime.php +++ b/Datatypes/SmartDateTime.php @@ -290,19 +290,20 @@ class SmartDateTime extends \DateTime // add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first) for($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) { - $days[] = $i+1; + $days[] = new \DateTime($previousMonth->format('Y') . '-' . $previousMonth->format('m') . '-' . ($i+1)); } // add normal count of current days $daysMonth = $this->getDaysOfMonth(); for($i = 1; $i <= $daysMonth; $i++) { - $days[] = $i; + $days[] = new \DateTime($this->format('Y') . '-' . $this->format('m') . '-' . ($i)); } // add remaining days to next month (7*6 - difference+count of current month) $remainingDays = 42 - $diffToWeekStart - $daysMonth; + $nextMonth = $this->createModify(0, 1); for($i = 1; $i <= $remainingDays; $i++) { - $days[] = $i; + $days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i)); } return $days;