Skip to content

Commit

Permalink
check for updatedAt to be set when rendering it
Browse files Browse the repository at this point in the history
  • Loading branch information
vladvelici committed Nov 7, 2024
1 parent 9959509 commit 51247a5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions demo/src/components/MessageComponent/MessageComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,16 @@ export const MessageComponent: React.FC<MessageProps> = ({
<span className="short">{shortDate(message.createdAt)}</span>
<span className="long">{message.createdAt.toLocaleString()}</span>
</span>
{message.isUpdated && (
<>
{ (message.isUpdated && message.updatedAt) ? <>
{' '}
&middot; Edited{' '}
<span className="sent-at-time">
<span className="short">{shortDate(message.updatedAt!)}</span>
<span className="long">{message.updatedAt!.toLocaleString()}</span>
<span className="short">{shortDate(message.updatedAt)}</span>
<span className="long">{message.updatedAt.toLocaleString()}</span>
</span>
{ message.updatedBy ? <span> by {message.updatedBy}</span> : '' }
</>
)}
</> : ''
}
</div>
<div
className={clsx('px-4 py-2 rounded-lg inline-block', {
Expand Down

0 comments on commit 51247a5

Please sign in to comment.