From: Raphaƫl Gertz Date: Sun, 29 Nov 2020 05:59:24 +0000 (+0100) Subject: Avoid double month append X-Git-Tag: 0.1.4~20 X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/airbundle/commitdiff_plain/a369baf6ea1fd299a5477a462a8cf4e5957cd982?hp=7eb1dd1416e1a29189b8c2191ccffa4b34bff323 Avoid double month append --- diff --git a/Repository/SessionRepository.php b/Repository/SessionRepository.php index 2a11c59..afe7335 100644 --- a/Repository/SessionRepository.php +++ b/Repository/SessionRepository.php @@ -156,10 +156,14 @@ class SessionRepository extends \Doctrine\ORM\EntityRepository { 'sessions' => [] ]; - //Append month for first day of month + //Detect month change if ($month != $date->format('m')) { $month = $date->format('m'); - $calendar[$Ymd]['title'] .= '/'.$month; + //Append month for first day of month + //XXX: except if today to avoid double add + if ($date->format('U') != strtotime('today')) { + $calendar[$Ymd]['title'] .= '/'.$month; + } } //Deal with today if ($date->format('U') == ($today = strtotime('today'))) { @@ -316,10 +320,14 @@ class SessionRepository extends \Doctrine\ORM\EntityRepository { 'sessions' => [] ]; - //Append month for first day of month + //Detect month change if ($month != $date->format('m')) { $month = $date->format('m'); - $calendar[$Ymd]['title'] .= '/'.$month; + //Append month for first day of month + //XXX: except if today to avoid double add + if ($date->format('U') != strtotime('today')) { + $calendar[$Ymd]['title'] .= '/'.$month; + } } //Deal with today if ($date->format('U') == ($today = strtotime('today'))) {