Skip to content
Snippets Groups Projects
Commit 8b18b2d1 authored by Moritz Strohm's avatar Moritz Strohm Committed by Jan-Hendrik Willms
Browse files

calendar/date/add: remove one second for dates that fullcalendar marked as all-day, fixes #3878

Closes #3878

Merge request studip/studip!2733
parent dbde657c
No related branches found
No related tags found
No related merge requests found
...@@ -356,8 +356,16 @@ class Calendar_DateController extends AuthenticatedController ...@@ -356,8 +356,16 @@ class Calendar_DateController extends AuthenticatedController
} }
$this->all_day_event = false; $this->all_day_event = false;
if ($mode === 'add' && Request::get('all_day') === '1') { if ($mode === 'add' && Request::bool('all_day')) {
$this->all_day_event = true; $this->all_day_event = true;
//Check for a fullcalendar all-day event ending. In that case, remove one second to have an all-day event
//that abides to the Stud.IP rules.
$end = new DateTime();
$end->setTimestamp($this->date->end);
if ($end->format('His') === '000000') {
$end = $end->sub(new DateInterval('PT1S'));
}
$this->date->end = $end->getTimestamp();
} else { } else {
$begin = new DateTime(); $begin = new DateTime();
$begin->setTimestamp(intval($this->date->begin)); $begin->setTimestamp(intval($this->date->begin));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment