Skip to content

Commit

Permalink
Fix RangeError - Invalid date (#331)
Browse files Browse the repository at this point in the history
date-fns no longer accepts null when formatting dates.
  • Loading branch information
jeff-horton-ho-sas committed Apr 23, 2024
1 parent 8d86eb5 commit e9472e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ukhomeoffice/asl-components",
"version": "13.4.0",
"version": "13.4.1",
"description": "React components for ASL layouts and elements",
"main": "src/index.jsx",
"styles": "styles/index.scss",
Expand Down
16 changes: 12 additions & 4 deletions src/licence-status-banner/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,23 @@ function LicenceStatusBanner({ licence, licenceType, isPdf, dateFormat, colour,
}

return <ul className="licence-dates">
<li>Granted: <span className="date">{format(issueDate, dateFormat)}</span></li>
{
status === 'revoked' && <li>Revoked: <span className="date">{format(revocationDate, dateFormat)}</span></li>
issueDate != null && <li>Granted: <span className="date">{format(issueDate, dateFormat)}</span></li>
}
{
status === 'expired' && <li>Expiry: <span className="date">{format(expiryDate, dateFormat)}</span></li>
status === 'revoked' && revocationDate != null && <li>
Revoked: <span className="date">{format(revocationDate, dateFormat)}</span>
</li>
}
{
status === 'suspended' && <li>Suspended: <span className="date">{format(suspendedDate, dateFormat)}</span></li>
status === 'expired' && expiryDate != null && <li>
Expiry: <span className="date">{format(expiryDate, dateFormat)}</span>
</li>
}
{
status === 'suspended' && suspendedDate != null && <li>
Suspended: <span className="date">{format(suspendedDate, dateFormat)}</span>
</li>
}
</ul>;
};
Expand Down

0 comments on commit e9472e2

Please sign in to comment.