mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 22:21:19 +08:00
FIX: properly handle invalid auto close date for polls
This commit is contained in:
@ -354,12 +354,14 @@ createWidget('discourse-poll-info', {
|
||||
|
||||
if (poll.close) {
|
||||
const closeDate = moment.utc(poll.close);
|
||||
const title = closeDate.format("LLL");
|
||||
const timeLeft = moment().to(closeDate.local(), true);
|
||||
if (closeDate.isValid()) {
|
||||
const title = closeDate.format("LLL");
|
||||
const timeLeft = moment().to(closeDate.local(), true);
|
||||
|
||||
result.push(new RawHtml({
|
||||
html: `<span class="info-text" title="${title}">${I18n.t("poll.automatic_close.closes_in", { timeLeft })}</span>`
|
||||
}));
|
||||
result.push(new RawHtml({
|
||||
html: `<span class="info-text" title="${title}">${I18n.t("poll.automatic_close.closes_in", { timeLeft })}</span>`
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user