fix: news articles showing 1970 dates when published_at is null
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
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:
parent
9f86aaf540
commit
4df7c67c13
2 changed files with 5 additions and 3 deletions
|
|
@ -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 && (
|
||||
<>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue