Skip to content

Commit

Permalink
Agenda: Fix RFC5545 date for ICS format when importing events - refs …
Browse files Browse the repository at this point in the history
…GH#3735
  • Loading branch information
carlangas159 committed Aug 10, 2021
1 parent 5d50b7b commit 7704137
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main/inc/lib/agenda.lib.php
Expand Up @@ -3114,7 +3114,16 @@ public function importEventFile($courseInfo, $file)
$calendar = Sabre\VObject\Reader::read($data);
$currentTimeZone = api_get_timezone();
if (!empty($calendar->VEVENT)) {
/** @var Sabre\VObject\Component\VEvent $event */
foreach ($calendar->VEVENT as $event) {
$tempDate = $event->DTSTART->getValue();
if ('Z' == substr($tempDate, -1) && 'UTC' != date('e', strtotime($tempDate))) {
$event->DTSTART->setValue(gmdate('Ymd\THis\Z', strtotime($tempDate)));
}
$tempDate = $event->DTEND->getValue();
if ('Z' == substr($tempDate, -1) && 'UTC' != date('e', strtotime($tempDate))) {
$event->DTEND->setValue(gmdate('Ymd\THis\Z', strtotime($tempDate)));
}
$start = $event->DTSTART->getDateTime();
$end = $event->DTEND->getDateTime();
//Sabre\VObject\DateTimeParser::parseDateTime(string $dt, \Sabre\VObject\DateTimeZone $tz)
Expand Down

0 comments on commit 7704137

Please sign in to comment.