fix invalid date

This commit is contained in:
Jade (Rose) Rowland 2024-01-20 13:00:33 -05:00
parent 0a349e1707
commit b45fd5ce3a

View File

@ -21,7 +21,9 @@ function PatternLabel({ pattern } /* : { pattern: Tables<'code'> } */) {
return (
<>{`${pattern.id}: ${
meta.title ?? pattern.hash ?? new Date(pattern.created_at).toLocaleDateString() ?? 'unnamed'
meta.title ?? pattern.hash ?? pattern.created_at != null
? new Date(pattern.created_at).toLocaleDateString()
: 'unnamed'
} by ${Array.isArray(meta.by) ? meta.by.join(',') : 'Anonymous'}`}</>
);
}