From 5fedebbf7f95158e9059c28009910d25c6fa8aa5 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 10 Aug 2017 10:33:49 +0200 Subject: [PATCH] Build plan for monthly calendar --- Datatypes/SmartDateTime.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Datatypes/SmartDateTime.php b/Datatypes/SmartDateTime.php index 1b07a67bc..470a87929 100644 --- a/Datatypes/SmartDateTime.php +++ b/Datatypes/SmartDateTime.php @@ -221,4 +221,15 @@ class SmartDateTime extends \DateTime return $w; } + public function getMonthCalendar(int $weekStartsWith = 0) : array + { + // get day of first day in month + // calculate difference to $weekStartsWith + // get days of previous month + // add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first) + // add normal count of current days + // add remaining days to next month (7*6 - difference+count of current month) + + // return maybe two dimensional array (one week = first dimension) one dimensional also ok with some easy calculations (one week = 7 days) + } }