mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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:
parent
6f76fb960b
commit
4285706d97
@ -182,7 +182,7 @@ function _downloadCalendarNode(element) {
|
||||
"data-starts-at",
|
||||
moment
|
||||
.tz(
|
||||
`${startDataset.date} ${startDataset.time || ""}`,
|
||||
`${startDataset.date} ${startDataset.time || ""}`.trim(),
|
||||
startDataset.timezone
|
||||
)
|
||||
.toISOString()
|
||||
@ -191,7 +191,10 @@ function _downloadCalendarNode(element) {
|
||||
node.setAttribute(
|
||||
"data-ends-at",
|
||||
moment
|
||||
.tz(`${endDataset.date} ${endDataset.time || ""}`, endDataset.timezone)
|
||||
.tz(
|
||||
`${endDataset.date} ${endDataset.time || ""}`.trim(),
|
||||
endDataset.timezone
|
||||
)
|
||||
.toISOString()
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user