diff --git a/src/components/polls/poll-footer.tsx b/src/components/polls/poll-footer.tsx index b9a341c5e7..402216a715 100644 --- a/src/components/polls/poll-footer.tsx +++ b/src/components/polls/poll-footer.tsx @@ -33,9 +33,11 @@ const PollFooter: React.FC = ({ poll, showResults, selected }): JSX e.preventDefault(); }; - const timeRemaining = poll.expired ? - intl.formatMessage(messages.closed) : - ; + const timeRemaining = poll.expires_at && ( + poll.expired ? + intl.formatMessage(messages.closed) : + + ); let votesCount = null; @@ -82,7 +84,7 @@ const PollFooter: React.FC = ({ poll, showResults, selected }): JSX {votesCount} - {poll.expires_at && ( + {poll.expires_at !== null && ( <> · {timeRemaining} diff --git a/src/schemas/poll.ts b/src/schemas/poll.ts index 73d27753a7..65ead6e149 100644 --- a/src/schemas/poll.ts +++ b/src/schemas/poll.ts @@ -14,7 +14,7 @@ const pollOptionSchema = z.object({ const pollSchema = z.object({ emojis: filteredArray(customEmojiSchema), expired: z.boolean().catch(false), - expires_at: z.string().datetime().catch(new Date().toUTCString()), + expires_at: z.string().datetime().nullable().catch(null), id: z.string(), multiple: z.boolean().catch(false), options: z.array(pollOptionSchema).min(2),