FIX: displays poll's close date in local time (#9656)

This commit is contained in:
Joffrey JAFFEUX 2020-05-06 22:18:47 +02:00 committed by GitHub
parent 7acb25db12
commit 029d091ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -745,7 +745,7 @@ createWidget("discourse-poll-buttons", {
} }
if (poll.get("close")) { if (poll.get("close")) {
const closeDate = moment.utc(poll.get("close")); const closeDate = moment(poll.get("close"));
if (closeDate.isValid()) { if (closeDate.isValid()) {
const title = closeDate.format("LLL"); const title = closeDate.format("LLL");
let label; let label;
@ -754,7 +754,7 @@ createWidget("discourse-poll-buttons", {
const age = relativeAge(closeDate.toDate(), { addAgo: true }); const age = relativeAge(closeDate.toDate(), { addAgo: true });
label = I18n.t("poll.automatic_close.age", { age }); label = I18n.t("poll.automatic_close.age", { age });
} else { } else {
const timeLeft = moment().to(closeDate.local(), true); const timeLeft = moment().to(closeDate, true);
label = I18n.t("poll.automatic_close.closes_in", { timeLeft }); label = I18n.t("poll.automatic_close.closes_in", { timeLeft });
} }