Skip to content

Commit

Permalink
fixup! fix(CalDAV reminders): Fix timezone drift for all-day events
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Feb 8, 2023
1 parent 2fa8c73 commit 4bf3043
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ public function getCalendarByUri($principal, $uri) {
}

/**
* @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp }|null
* @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string }|null
*/
public function getCalendarById(int $calendarId): ?array {
$fields = array_column($this->propertyMap, 0);
Expand Down
9 changes: 6 additions & 3 deletions apps/dav/lib/CalDAV/Reminder/ReminderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public function onCalendarObjectCreate(array $objectData):void {

try {
$triggerTime = $valarm->getEffectiveTriggerTime();
if (!$triggerTime->getTimezone() || $triggerTime->getTimezone()->getName() === 'UTC') {
if ($triggerTime->getTimezone() === false || $triggerTime->getTimezone()->getName() === 'UTC') {
$triggerTime = new DateTimeImmutable(
$triggerTime->format('Y-m-d H:i:s'),
$calendarTimeZone
Expand Down Expand Up @@ -396,7 +396,7 @@ private function getRemindersForVAlarm(VAlarm $valarm,
$isRelative = $this->isAlarmRelative($valarm);
/** @var DateTimeImmutable $notificationDate */
$notificationDate = $valarm->getEffectiveTriggerTime();
if (!$notificationDate->getTimezone() || $notificationDate->getTimezone()->getName() === 'UTC') {
if ($notificationDate->getTimezone() === false || $notificationDate->getTimezone()->getName() === 'UTC') {
$notificationDate = new DateTimeImmutable(
$notificationDate->format('Y-m-d H:i:s'),
$calendarTimeZone
Expand Down Expand Up @@ -857,7 +857,10 @@ private function getCalendarTimeZone(int $calendarid): DateTimeZone {
}
// This property contains a VCALENDAR with a single
// VTIMEZONE.
/** @var VObject\Component\VCalendar $vtimezoneObj */
$vtimezoneObj = VObject\Reader::read($calendarInfo[$tzProp]);
return $vtimezoneObj->VTIMEZONE->getTimeZone();
/** @var VObject\Component\VTimeZone $vtimezone */
$vtimezone = $vtimezoneObj->VTIMEZONE;
return $vtimezone->getTimeZone();
}
}

0 comments on commit 4bf3043

Please sign in to comment.