Skip to content
Snippets Groups Projects
Commit b46ffe23 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

parent dbde657c
No related branches found
No related tags found
No related merge requests found
...@@ -358,6 +358,14 @@ class Calendar_DateController extends AuthenticatedController ...@@ -358,6 +358,14 @@ 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::get('all_day') === '1') {
$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.
Please register or to comment