From 974e1de0c90ece4b0a6fb631b6ec2cec8dfbf2fe Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Wed, 11 Feb 2026 10:38:16 +0100 Subject: [PATCH] fix(integration): add timezone to Talk created calendar events Signed-off-by: Anna Larch --- lib/Controller/RoomController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index c7d76740652..d3bf88fca75 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -8,6 +8,7 @@ namespace OCA\Talk\Controller; +use OCA\DAV\CalDAV\TimezoneService; use OCA\Talk\Capabilities; use OCA\Talk\Config; use OCA\Talk\Events\AAttendeeRemovedEvent; @@ -100,6 +101,7 @@ use OCP\IUser; use OCP\IUserManager; use OCP\Security\Bruteforce\IThrottler; +use OCP\Server; use OCP\User\Events\UserLiveStatusEvent; use OCP\UserStatus\IManager as IUserStatusManager; use OCP\UserStatus\IUserStatus; @@ -3104,13 +3106,16 @@ public function scheduleMeeting(string $calendarUri, int $start, ?array $attende return new DataResponse(['error' => 'email'], Http::STATUS_BAD_REQUEST); } - $startDate = $this->timeFactory->getDateTime('@' . $start); + $timezoneService = Server::get(TimezoneService::class); + $userTimezone = $timezoneService->getUserTimezone($user->getUID()); + $timezone = new \DateTimeZone($userTimezone); + $startDate = $this->timeFactory->getDateTime('@' . $start)->setTimezone($timezone); if ($start < $this->timeFactory->getTime()) { return new DataResponse(['error' => 'start'], Http::STATUS_BAD_REQUEST); } if ($end !== null) { - $endDate = $this->timeFactory->getDateTime('@' . $end); + $endDate = $this->timeFactory->getDateTime('@' . $end)->setTimezone($timezone); if ($start >= $end) { return new DataResponse(['error' => 'end'], Http::STATUS_BAD_REQUEST); }