From e030b62bede1e07d31650ef4e5feafc62736cfd4 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sat, 3 Jan 2026 19:31:58 +0100 Subject: [PATCH] drunken date options --- app/Console/Commands/SyncBeerLeague.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/SyncBeerLeague.php b/app/Console/Commands/SyncBeerLeague.php index f642e2a..98eb5b5 100644 --- a/app/Console/Commands/SyncBeerLeague.php +++ b/app/Console/Commands/SyncBeerLeague.php @@ -89,7 +89,7 @@ class SyncBeerLeague extends Command { $episode->event()->associate($event); $episode->title = $row[0].' vs '.$row[1]; $episode->comment = $row[4].' - '.$row[7]; - $start = Carbon::createFromFormat('m/d/Y h:i A \E\S\T', $row[5].' '.$row[6], 'America/Detroit')->setTimezone('UTC'); + $start = $this->guessDate($row[5].' '.$row[6]); if (!$episode->start || $start->ne($episode->start)) { $episode->start = $start; } @@ -104,6 +104,14 @@ class SyncBeerLeague extends Command { } } + private function guessDate($date) { + try { + return Carbon::createFromFormat('m/d/Y h:i A \E\S\T', $date, 'America/Detroit')->setTimezone('UTC'); + } catch (\Exception $e) { + return Carbon::createFromFormat('Y-m-d H:i \E\S\T', $date, 'America/Detroit')->setTimezone('UTC'); + } + } + private function syncPlayer(Episode $episode, string $codename): EpisodePlayer|null { if (empty($codename)) { return null; -- 2.47.3