mirror of
https://github.com/FranP-code/format_twitter_projects_accounts_tweets.git
synced 2025-10-13 00:32:19 +00:00
Fix invalid time value error in date formatting
This commit is contained in:
committed by
GitHub
parent
90e62199c5
commit
6438fcb12f
@@ -11,7 +11,9 @@ interface ProjectCardProps {
|
||||
}
|
||||
|
||||
export function ProjectCard({ project, onSeenStatusChange }: ProjectCardProps) {
|
||||
const formattedDate = formatDistanceToNow(new Date(project.created_at), { addSuffix: true });
|
||||
const formattedDate = project.created_at && !isNaN(new Date(project.created_at).getTime())
|
||||
? formatDistanceToNow(new Date(project.created_at), { addSuffix: true })
|
||||
: 'N/A';
|
||||
const [seen, setSeen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -205,7 +205,9 @@ export function ProjectsTable({ projects, title, showUrlColumn = true, onSeenSta
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<div className="text-sm w-full">
|
||||
{formatDistanceToNow(new Date(row.original.created_at), { addSuffix: true })}
|
||||
{row.original.created_at && !isNaN(new Date(row.original.created_at).getTime())
|
||||
? formatDistanceToNow(new Date(row.original.created_at), { addSuffix: true })
|
||||
: 'N/A'}
|
||||
</div>
|
||||
),
|
||||
size: 140,
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'path';
|
||||
|
||||
export interface TwitterProject {
|
||||
id: string;
|
||||
created_at: string;
|
||||
created_at: string | null;
|
||||
project_description: string;
|
||||
project_url: string | null;
|
||||
original_tweet_url: string | null;
|
||||
|
||||
Reference in New Issue
Block a user