fix: news articles showing 1970 dates when published_at is null
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

Backend falls back to fetched_at when published_at is NULL in the database,
so the API always returns a meaningful date. Frontend also handles null
defensively to avoid new Date(null) producing Unix epoch 0.
This commit is contained in:
Viktor Barzin 2026-02-23 22:48:16 +00:00
parent 9f86aaf540
commit 4df7c67c13
No known key found for this signature in database
GPG key ID: 0EB088298288D958
2 changed files with 5 additions and 3 deletions

View file

@ -8,7 +8,7 @@ interface Article {
title: string;
source: string;
url: string;
published_at: string;
published_at: string | null;
ticker: string;
sentiment_score: number;
confidence: number;
@ -105,7 +105,9 @@ export default function NewsFeed() {
<span>{article.source}</span>
<span>|</span>
<span>
{new Date(article.published_at).toLocaleString()}
{article.published_at
? new Date(article.published_at).toLocaleString()
: 'Date unknown'}
</span>
{article.ticker && (
<>