Skip to content

Commit

Permalink
Merge pull request #166 from SCCapstone/HandleNullDate
Browse files Browse the repository at this point in the history
Handle null time
  • Loading branch information
epadams authored Dec 5, 2023
2 parents f6fa035 + 7944fa0 commit 6aec213
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions FU.SPA/src/components/PostCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ import {
} from '@mui/material';

const PostCard = ({ post }) => {
const dateTimeString = new Date(post.startTime).toLocaleString('en-US', {
dateStyle: 'medium',
timeStyle: 'short',
});
let dateTimeString = 'Unspecified time';

if (post.startTime) {
dateTimeString = new Date(post.startTime).toLocaleString('en-US', {
dateStyle: 'medium',
timeStyle: 'short',
});
}

return (
<Card style={{ textAlign: 'left' }}>
Expand Down

0 comments on commit 6aec213

Please sign in to comment.