Skip to content

Commit

Permalink
Fix RangeError - Invalid date
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 16, 2024
1 parent 8d86eb5 commit c641dba
Showing 1 changed file with 12 additions and 4 deletions.
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 c641dba

Please sign in to comment.