From a5039867baa1a9c96e330e54e6c70e4f30a6f61c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 11 Aug 2017 20:25:44 +0200 Subject: [PATCH] Return array of datetimes instead of values --- Datatypes/SmartDateTime.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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;