Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
- Fix date parsing issue in BRND booking feed type
- [#313](https://github.com/os2display/display-api-service/pull/313)
- Add BRND booking feed type

Expand Down
5 changes: 3 additions & 2 deletions src/Feed/BrndFeedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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'])) {
Expand All @@ -102,7 +103,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;
}
Expand All @@ -118,7 +119,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;
}
Expand Down