diff --git a/lib/classes/calendar/EventData.class.php b/lib/classes/calendar/EventData.class.php index 82afe6f3b7751e53dd3357d35f771ff168b6856e..95e89b0ec6ae53f30dd7d924a852b3cdbcd5ef51 100644 --- a/lib/classes/calendar/EventData.class.php +++ b/lib/classes/calendar/EventData.class.php @@ -69,15 +69,29 @@ class EventData public function toFullcalendarEvent() { - //Note: The timezone must not be transmitted or - //the events may be shifted when there is a timezone - //or daylight saving time difference between the server - //and the client! - return [ + // Note: The timezone must not be transmitted or + // the events may be shifted when there is a timezone + // or daylight saving time difference between the server + // and the client! + // To display all-day events correctly in fullcalendar + // reduce the start and end to date without time and add one day + // to the end date... + if ($this->all_day) { + $fc_date = [ + 'allDay' => true, + 'start' => $this->begin->format('Y-m-d'), + 'end' => $this->end->modify('+1 day')->format('Y-m-d') + ]; + } else { + $fc_date = [ + 'allDay' => false, + 'start' => $this->begin->format('Y-m-d\TH:i:s'), + 'end' => $this->end->format('Y-m-d\TH:i:s') + ]; + } + + return $fc_date + [ 'resourceId' => $this->range_id, - 'start' => $this->begin->format('Y-m-d\TH:i:s'), - 'end' => $this->end->format('Y-m-d\TH:i:s'), - 'allDay' => $this->all_day, 'title' => $this->title, 'classNames' => $this->event_classes, 'textColor' => $this->text_colour, diff --git a/lib/models/calendar/CalendarDateAssignment.class.php b/lib/models/calendar/CalendarDateAssignment.class.php index 101cb9642b581d4a2524b9a831030295ce5f3d8c..4e084c2436e867b89c7770539c1a78cb41228129 100644 --- a/lib/models/calendar/CalendarDateAssignment.class.php +++ b/lib/models/calendar/CalendarDateAssignment.class.php @@ -507,8 +507,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event return false; } $end = $this->getEnd(); - return ($end->format('Ymd') === $begin->format('Ymd') - && $end->format('His') === '235959'); + return $end->format('His') === '235959'; } public function isWritable(string $user_id): bool