diff --git a/Blacklight/Binaries.php b/Blacklight/Binaries.php index e090f7caf..b16572cd4 100644 --- a/Blacklight/Binaries.php +++ b/Blacklight/Binaries.php @@ -296,7 +296,7 @@ class Binaries // Generate postdate for first record, for those that upgraded. if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] !== 0) { $groupMySQL['first_record_postdate'] = $this->postdate($groupMySQL['first_record'], $groupNNTP); - UsenetGroup::query()->where('id', $groupMySQL['id'])->update(['first_record_postdate' => Carbon::createFromTimestamp($groupMySQL['first_record_postdate'])]); + UsenetGroup::query()->where('id', $groupMySQL['id'])->update(['first_record_postdate' => Carbon::createFromTimestamp($groupMySQL['first_record_postdate'], date_default_timezone_get())]); } // Get first article we want aka the oldest. @@ -418,7 +418,8 @@ class Binaries [ 'first_record' => $scanSummary['firstArticleNumber'], 'first_record_postdate' => Carbon::createFromTimestamp( - $groupMySQL['first_record_postdate'] + $groupMySQL['first_record_postdate'], + date_default_timezone_get() ), ] ); @@ -434,7 +435,7 @@ class Binaries ->update( [ 'last_record' => $scanSummary['lastArticleNumber'], - 'last_record_postdate' => Carbon::createFromTimestamp($scanSummary['lastArticleDate']), + 'last_record_postdate' => Carbon::createFromTimestamp($scanSummary['lastArticleDate'], date_default_timezone_get()), 'last_updated' => now(), ] ); @@ -1236,7 +1237,7 @@ class Binaries if ($this->_echoCLI) { $this->colorCli->primary( PHP_EOL.'Found article #'.$wantedArticle.' which has a date of '.date('r', $articleTime). - ', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime)->diffInDays(Carbon::createFromTimestamp($articleTime), true).'days.' + ', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime, date_default_timezone_get())->diffInDays(Carbon::createFromTimestamp($articleTime), true).'days.' ); } diff --git a/Blacklight/NZBImport.php b/Blacklight/NZBImport.php index 90a2cc855..cbf6343ac 100755 --- a/Blacklight/NZBImport.php +++ b/Blacklight/NZBImport.php @@ -217,7 +217,7 @@ class NZBImport $posterName = (string) $file->attributes()->poster; } if ($postDate === false) { - $postDate = Carbon::createFromTimestamp((string) $file->attributes()->date)->format('Y-m-d H:i:s'); + $postDate = Carbon::createFromTimestamp((string) $file->attributes()->date, date_default_timezone_get())->format('Y-m-d H:i:s'); } // Make a fake message array to use to check the blacklist. diff --git a/Blacklight/PopulateAniDB.php b/Blacklight/PopulateAniDB.php index 4c498408c..9a1029bef 100644 --- a/Blacklight/PopulateAniDB.php +++ b/Blacklight/PopulateAniDB.php @@ -273,7 +273,7 @@ class PopulateAniDB */ private function populateMainTable(): void { - $lastUpdate = Carbon::createFromTimestamp($this->lastUpdate); + $lastUpdate = Carbon::createFromTimestamp($this->lastUpdate, date_default_timezone_get()); $current = now(); if ($current->diff($lastUpdate)->format('%d') > $this->updateInterval) { diff --git a/Blacklight/Tmux.php b/Blacklight/Tmux.php index 7d1696036..49ed47cae 100755 --- a/Blacklight/Tmux.php +++ b/Blacklight/Tmux.php @@ -270,7 +270,7 @@ class Tmux public function relativeTime($_time): string { - return Carbon::createFromTimestamp($_time)->ago(); + return Carbon::createFromTimestamp($_time, date_default_timezone_get())->ago(); } public function command_exist($cmd): bool diff --git a/app/Models/ReleaseFile.php b/app/Models/ReleaseFile.php index d5b525741..0161de2e4 100644 --- a/app/Models/ReleaseFile.php +++ b/app/Models/ReleaseFile.php @@ -100,7 +100,7 @@ class ReleaseFile extends Model if ($createdTime === 0) { $adjustedCreatedTime = now()->format('Y-m-d H:i:s'); } else { - $adjustedCreatedTime = Carbon::createFromTimestamp($createdTime)->format('Y-m-d H:i:s'); + $adjustedCreatedTime = Carbon::createFromTimestamp($createdTime, date_default_timezone_get())->format('Y-m-d H:i:s'); } } else { $adjustedCreatedTime = $createdTime;