diff options
| author | Peter Thienel <thienel@data-quest.de> | 2024-03-22 09:27:53 +0000 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2024-03-22 09:27:53 +0000 |
| commit | 2b897359149fde4d38e72c111dd6762d3c4ad332 (patch) | |
| tree | b06a07dd1f37f8a98b6d88ed9132143d3e80967f /lib/classes | |
| parent | 7f62272a741437a22af4de89c10f9087b7e39d15 (diff) | |
Resolve: "Ganztägige Termine über mehrere Tage werden nicht als Ganztagstermine dargestellt"
Closes #3875
Merge request studip/studip!2731
Diffstat (limited to 'lib/classes')
| -rw-r--r-- | lib/classes/calendar/EventData.class.php | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/classes/calendar/EventData.class.php b/lib/classes/calendar/EventData.class.php index 82afe6f..95e89b0 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, |
