From 855d5b9ad0e958889277a2c42297dcab6ac2a660 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Tue, 27 Jan 2026 17:14:38 +0100 Subject: [PATCH] Fix missing item date and description --- library/Feeds/Parser/Result/FeedItem.php | 6 +++--- library/Feeds/Web/Item.php | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/library/Feeds/Parser/Result/FeedItem.php b/library/Feeds/Parser/Result/FeedItem.php index 16433cf..26c8fa0 100644 --- a/library/Feeds/Parser/Result/FeedItem.php +++ b/library/Feeds/Parser/Result/FeedItem.php @@ -12,7 +12,7 @@ class FeedItem public ?Feed $feed = null; public ?string $title = null; public ?string $link = null; - public ?string $description = null; + public string $description = ''; public array $categories = []; public ?string $creator = null; public ?string $image = null; @@ -20,8 +20,8 @@ class FeedItem public function compareDate(FeedItem $other): int { - $ad = $this->date ?? new DateTime('NOW'); - $bd = $other->date ?? new DateTime('NOW'); + $ad = $this->date ?? new DateTime('@0'); + $bd = $other->date ?? new DateTime('@0'); if ($ad == $bd) { return 0; diff --git a/library/Feeds/Web/Item.php b/library/Feeds/Web/Item.php index 3f7dfa6..1951a54 100644 --- a/library/Feeds/Web/Item.php +++ b/library/Feeds/Web/Item.php @@ -103,7 +103,7 @@ protected function getCategoriesElement(): ?BaseHtmlElement protected function getContentElement(): ?BaseHtmlElement { - $text = $this->item->description; + $text = $this->item->description ?? ''; $description = new FeedContent($text); return HtmlElement::create( @@ -122,7 +122,10 @@ protected function getLink(): ?string protected function getDate(): BaseHtmlElement { - return (new TimeAgo($this->item->date->getTimestamp())); + $d = $this->item->date; + $ts = $this->item->date !== null ? $this->item->date->getTimestamp() : 0; + + return (new TimeAgo($ts)); } protected function assembleHeader(): BaseHtmlElement