diff options
Diffstat (limited to 'src/components/PollCard/PollCard.tsx')
-rw-r--r-- | src/components/PollCard/PollCard.tsx | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index 64fab34..5427fd6 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -6,6 +6,7 @@ import { useSnackbar } from 'notistack'; import PercentageBar from './PercentageBar'; import UserStrip from '../UserStrip/UserStrip'; +import DateString from '../DateString/DateString'; import BackgroundImage from '../Image/BackgroundImage'; import { post } from '../../requests'; import { useAuth } from '../../hooks/useAuth'; @@ -15,14 +16,6 @@ interface PropTypes { setPoll: (poll: Poll) => void; } -const DATE_FORMAT = { - month: 'long', - day: 'numeric', - year: 'numeric', - hour: '2-digit', - minute: '2-digit' -}; - const useStyles = makeStyles(theme => ({ media: { display: 'flex', @@ -56,7 +49,6 @@ const PollCard: React.FC<PropTypes> = React.memo(({ poll, setPoll }) => { const { author, contents: { left, right }, vote } = poll; const { enqueueSnackbar } = useSnackbar(); const { isAuthenticated } = useAuth(); - const date: string = new Date(poll.createdAt).toLocaleString('default', DATE_FORMAT); const handleVote = (which: Which) => () => { if (!isAuthenticated) { @@ -98,7 +90,7 @@ const PollCard: React.FC<PropTypes> = React.memo(({ poll, setPoll }) => { return ( <Card elevation={3}> - <UserStrip user={author} info={date} /> + <UserStrip user={author} info={<DateString value={poll.createdAt} />} /> {poll.description && ( <Typography className={classes.description}> {poll.description} |