Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@

private function parseBrndBooking(array $booking): array
{
$tz = new \DateTimeZone(self::BRND_API_TIMEZONE);

Check failure on line 97 in src/Feed/BrndFeedType.php

View workflow job for this annotation

GitHub Actions / Psalm (PHP 8.3)

UndefinedConstant

src/Feed/BrndFeedType.php:97:33: UndefinedConstant: Constant App\Feed\BrndFeedType::BRND_API_TIMEZONE is not defined (see https://psalm.dev/020)
// Parse start time
$startDateTime = null;
if (!empty($booking['dato']) && isset($booking['starttid']) && is_string($booking['starttid'])) {
Expand All @@ -102,7 +103,7 @@
$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 @@
$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
Loading