mirror of
https://github.com/discourse/discourse.git
synced 2025-06-19 22:23:04 +08:00
FIX: local date trim when no time available (#14525)
When there is a blank space in the end of date, moment is returning a different value: ```javascript console.log(moment.tz("2021-09-09 ", "Australia/Sydney").toISOString()); // 2021-09-09T00:00:00.000Z console.log(moment.tz("2021-09-09", "Australia/Sydney").toISOString()); // 2021-09-08T14:00:00.000Z ```
This commit is contained in:

committed by
GitHub

parent
6f76fb960b
commit
4285706d97
@ -182,7 +182,7 @@ function _downloadCalendarNode(element) {
|
|||||||
"data-starts-at",
|
"data-starts-at",
|
||||||
moment
|
moment
|
||||||
.tz(
|
.tz(
|
||||||
`${startDataset.date} ${startDataset.time || ""}`,
|
`${startDataset.date} ${startDataset.time || ""}`.trim(),
|
||||||
startDataset.timezone
|
startDataset.timezone
|
||||||
)
|
)
|
||||||
.toISOString()
|
.toISOString()
|
||||||
@ -191,7 +191,10 @@ function _downloadCalendarNode(element) {
|
|||||||
node.setAttribute(
|
node.setAttribute(
|
||||||
"data-ends-at",
|
"data-ends-at",
|
||||||
moment
|
moment
|
||||||
.tz(`${endDataset.date} ${endDataset.time || ""}`, endDataset.timezone)
|
.tz(
|
||||||
|
`${endDataset.date} ${endDataset.time || ""}`.trim(),
|
||||||
|
endDataset.timezone
|
||||||
|
)
|
||||||
.toISOString()
|
.toISOString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user