fix(RemoteExplorer): guard against invalid dates being rendered

This commit is contained in:
jakeaturner 2026-07-18 16:52:37 +00:00
parent f9f9969d33
commit 55e040681f
No known key found for this signature in database
GPG Key ID: B1072EBDEECE328D
1 changed files with 4 additions and 2 deletions

View File

@ -638,6 +638,8 @@ export default function ZimRemoteExplorer() {
]} ]}
expandable={{ expandable={{
expandedRowRender(record) { expandedRowRender(record) {
const issuedDate = record.issued ? new Date(record.issued) : null
const hasValidIssuedDate = issuedDate && !Number.isNaN(issuedDate.getTime())
return ( return (
<div className="py-4 px-6"> <div className="py-4 px-6">
<p className="text-sm text-text-primary mb-4">{record.summary}</p> <p className="text-sm text-text-primary mb-4">{record.summary}</p>
@ -682,13 +684,13 @@ export default function ZimRemoteExplorer() {
</span> </span>
</div> </div>
)} )}
{record.issued && ( {hasValidIssuedDate && (
<div> <div>
<span className="text-text-muted">Issued: </span> <span className="text-text-muted">Issued: </span>
<span className="text-text-primary"> <span className="text-text-primary">
{new Intl.DateTimeFormat('en-US', { {new Intl.DateTimeFormat('en-US', {
dateStyle: 'medium', dateStyle: 'medium',
}).format(new Date(record.issued))} }).format(issuedDate!)}
</span> </span>
</div> </div>
)} )}