Skip to content

Commit

Permalink
chore: Use Boolean() to render dates
Browse files Browse the repository at this point in the history
  • Loading branch information
abshierjoel committed Jun 21, 2023
1 parent 48b8f8e commit c00fb18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/operator/OrgOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const OrgOverlay: FC = () => {
const deleteOn = organization?.deleteOn
? new Date(organization?.deleteOn)
: null
const hasDeleteDate = Boolean(deleteOn)

return (
<Overlay
Expand Down Expand Up @@ -187,7 +188,7 @@ const OrgOverlay: FC = () => {
Delete On
</label>
<p>
{organization?.state === 'suspended' && deleteOn
{organization?.state === 'suspended' && hasDeleteDate
? `${deleteOn.toLocaleTimeString()} ${deleteOn.toDateString()}`
: 'N/A'}
</p>
Expand Down
3 changes: 2 additions & 1 deletion src/operator/account/AccountGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const AccountGrid: FC = () => {
const cancelledAt = account?.cancelledAt
? new Date(account?.cancelledAt)
: null
const hasCancelledAt = Boolean(cancelledAt)

return (
<FlexBox
Expand Down Expand Up @@ -54,7 +55,7 @@ const AccountGrid: FC = () => {
<AccountField
header="Cancelled At"
body={
account.type === 'cancelled' && cancelledAt
account.type === 'cancelled' && hasCancelledAt
? `${cancelledAt.toLocaleTimeString()} ${cancelledAt.toDateString()}`
: 'N/A'
}
Expand Down

0 comments on commit c00fb18

Please sign in to comment.