From 1febce1749248fad0f8789e3f83073bdb3f60432 Mon Sep 17 00:00:00 2001 From: Agnete Moos Date: Tue, 25 Nov 2025 12:36:08 +0100 Subject: [PATCH 1/5] Add timezone support for booking date parsing in BrndFeedType --- src/Feed/BrndFeedType.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Feed/BrndFeedType.php b/src/Feed/BrndFeedType.php index 66b0f96e..625f2998 100644 --- a/src/Feed/BrndFeedType.php +++ b/src/Feed/BrndFeedType.php @@ -12,6 +12,7 @@ use Psr\Cache\CacheItemPoolInterface; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; +use DateTimeZone; /** * Brnd Bookingsystem Feed. @@ -94,6 +95,7 @@ public function getData(Feed $feed): array private function parseBrndBooking(array $booking): array { + $tz = new \DateTimeZone('Europe/Copenhagen'); // Parse start time $startDateTime = null; if (!empty($booking['dato']) && isset($booking['starttid']) && is_string($booking['starttid'])) { @@ -102,7 +104,7 @@ private function parseBrndBooking(array $booking): array $startTimeString = preg_replace('/\.(\d{6})\d+$/', '.$1', $booking['starttid']); $dateOnly = substr($booking['dato'], 0, 10); $dateTimeString = $dateOnly.' '.$startTimeString; - $startDateTime = \DateTimeImmutable::createFromFormat('m/d/Y H:i:s.u', $dateTimeString); + $startDateTime = \DateTimeImmutable::createFromFormat('m/d/Y H:i:s.u', $dateTimeString, $tz); if (false === $startDateTime) { $startDateTime = null; } @@ -118,7 +120,7 @@ private function parseBrndBooking(array $booking): array $endTimeString = preg_replace('/\.(\d{6})\d+$/', '.$1', $booking['sluttid']); $dateOnly = substr($booking['dato'], 0, 10); $dateTimeString = $dateOnly.' '.$endTimeString; - $endDateTime = \DateTimeImmutable::createFromFormat('m/d/Y H:i:s.u', $dateTimeString); + $endDateTime = \DateTimeImmutable::createFromFormat('m/d/Y H:i:s.u', $dateTimeString, $tz); if (false === $endDateTime) { $endDateTime = null; } From d1ad65b287b14d8db8c1a719abfefd21f455db37 Mon Sep 17 00:00:00 2001 From: Agnete Moos Date: Tue, 25 Nov 2025 13:42:54 +0100 Subject: [PATCH 2/5] Add BRND booking bug fix to changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55202752..fa33d5ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- [#333](https://github.com/os2display/display-api-service/pull/333) + - Add BRND booking feed type - [#313](https://github.com/os2display/display-api-service/pull/313) - Add BRND booking feed type From d7a527a4f80626e932905fdbd045890abbdbdf38 Mon Sep 17 00:00:00 2001 From: Agnete Moos Date: Tue, 25 Nov 2025 13:44:35 +0100 Subject: [PATCH 3/5] Fix entry in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa33d5ac..4d93d68d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - [#333](https://github.com/os2display/display-api-service/pull/333) - - Add BRND booking feed type + - Fix date parsing issue in BRND booking feed type - [#313](https://github.com/os2display/display-api-service/pull/313) - Add BRND booking feed type From c922996bd00d011b5b8eae9879d7b9d2678d2a30 Mon Sep 17 00:00:00 2001 From: Agnete Moos Date: Tue, 25 Nov 2025 13:50:32 +0100 Subject: [PATCH 4/5] Remove unused DateTimeZone import from BrndFeedType --- src/Feed/BrndFeedType.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Feed/BrndFeedType.php b/src/Feed/BrndFeedType.php index 625f2998..a0e4b15b 100644 --- a/src/Feed/BrndFeedType.php +++ b/src/Feed/BrndFeedType.php @@ -12,7 +12,6 @@ use Psr\Cache\CacheItemPoolInterface; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; -use DateTimeZone; /** * Brnd Bookingsystem Feed. From 2c09859076e7a10c58fc7f907d7bc8a6e2e95e93 Mon Sep 17 00:00:00 2001 From: agnetemoos Date: Thu, 27 Nov 2025 11:03:55 +0100 Subject: [PATCH 5/5] Update src/Feed/BrndFeedType.php That is a fine idea. I just dont have time to do it before thursday or friday next week. Co-authored-by: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> --- src/Feed/BrndFeedType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Feed/BrndFeedType.php b/src/Feed/BrndFeedType.php index a0e4b15b..bafec2bd 100644 --- a/src/Feed/BrndFeedType.php +++ b/src/Feed/BrndFeedType.php @@ -94,7 +94,7 @@ public function getData(Feed $feed): array private function parseBrndBooking(array $booking): array { - $tz = new \DateTimeZone('Europe/Copenhagen'); + $tz = new \DateTimeZone(self::BRND_API_TIMEZONE); // Parse start time $startDateTime = null; if (!empty($booking['dato']) && isset($booking['starttid']) && is_string($booking['starttid'])) {