Fix being unable to vote in polls without an expiration date (#39949)
This commit is contained in:
1 parent
14108d2c06
commit
9e5f298350
2 files changed
+3
-3
No files matched your search
@@ -36,7 +36,7 @@ const messages = defineMessages({
|
||||
});
|
||||
|
||||
const isPollExpired = (expiresAt: Model.Poll['expires_at']) =>
|
||||
new Date(expiresAt).getTime() < Date.now();
|
||||
expiresAt !== null && new Date(expiresAt).getTime() < Date.now();
|
||||
|
||||
interface PollProps {
|
||||
pollId: string;
|
||||
@@ -64,7 +64,7 @@ export const Poll: React.FC<PollProps> = ({ pollId, disabled, status }) => {
|
||||
return poll.expired || isPollExpired(poll.expires_at);
|
||||
}, [poll]);
|
||||
const timeRemaining = useMemo(() => {
|
||||
if (!poll) {
|
||||
if (!poll?.expires_at) {
|
||||
return null;
|
||||
}
|
||||
if (expired) {
|
||||
|
||||
Reference in new issue
Block a user