Bugfix timezone on events

This commit is contained in:
Thomas Günther 2024-03-02 18:13:44 +01:00
parent 9835f32dfa
commit dd6af287f3
2 changed files with 8 additions and 12 deletions

View File

@ -154,21 +154,20 @@ class Event
{
foreach ($data as $key => $value) {
if ($key == 'DTSTART_array' || $key == 'DTEND_array') {
$timeZone = 'Europe/Berlin';
if (isset($value[0]['TZID'])) {
$timeZone = $value[0]['TZID'];
}
$dateString = $value[1];
$dateTime = \DateTime::createFromFormat('Ymd\THis', $dateString);
$dateTime = \DateTime::createFromFormat('Ymd\THis', $dateString, new \DateTimeZone($timeZone));
if (false === $dateTime) {
$this->wholeDay = true;
$dateTime = \DateTime::createFromFormat('Ymd', $dateString);
$dateTime = \DateTime::createFromFormat('Ymd', $dateString, new \DateTimeZone($timeZone));
}
$timeZone = 'Europe/Berlin';
if (isset($value[0]['TZID'])) {
$timeZone = $value[0]['TZID'];
}
$dateTime->setTimezone(new \DateTimeZone($timeZone));
$dateTime->setTimezone(new \DateTimeZone('UTC'));
if ($key == 'DTSTART_array') {
$this->start = $dateTime->format('d.m.Y H:i:s');
$this->startInt = $dateTime->getTimestamp();
@ -176,9 +175,7 @@ class Event
$this->end = $dateTime->format('d.m.Y H:i:s');
$this->endInt = $dateTime->getTimestamp();
}
} else {
$variable = self::snakeCase($key);
if (property_exists($this, $variable)) {
$this->{$variable} = $this->prepareData($value);

View File

@ -2223,7 +2223,6 @@ class ICal
if ($ignoreUtc && strtoupper($timeZone) === self::TIME_ZONE_UTC) {
return null;
}
return $timeZone;
}