FIX: clone dateTime before changing timezone
This commit is contained in:
parent
b339d67401
commit
c131903e56
|
@ -201,14 +201,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function _createDateTimeRange(dateTime, timezone) {
|
function _createDateTimeRange(dateTime, timezone) {
|
||||||
const startRange = dateTime.tz(timezone).format("LLL");
|
const dt = moment(dateTime).tz(timezone);
|
||||||
const separator = "→";
|
|
||||||
const endRange = dateTime
|
|
||||||
.add(24, "hours")
|
|
||||||
.tz(timezone)
|
|
||||||
.format("LLL");
|
|
||||||
|
|
||||||
return `${startRange} ${separator} ${endRange}`;
|
return [
|
||||||
|
dt.format("LLL"),
|
||||||
|
"→",
|
||||||
|
dt.add(24, "hours").format("LLL"),
|
||||||
|
].join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function _generatePreviews(dateTime, displayedTimezone, options) {
|
function _generatePreviews(dateTime, displayedTimezone, options) {
|
||||||
|
@ -222,7 +221,7 @@
|
||||||
timezone: watchingUserTimezone,
|
timezone: watchingUserTimezone,
|
||||||
current: true,
|
current: true,
|
||||||
dateTime: options.time
|
dateTime: options.time
|
||||||
? dateTime.tz(watchingUserTimezone).format("LLL")
|
? moment(dateTime).tz(watchingUserTimezone).format("LLL")
|
||||||
: _createDateTimeRange(dateTime, watchingUserTimezone)
|
: _createDateTimeRange(dateTime, watchingUserTimezone)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -249,7 +248,7 @@
|
||||||
previewedTimezones.push({
|
previewedTimezones.push({
|
||||||
timezone,
|
timezone,
|
||||||
dateTime: options.time
|
dateTime: options.time
|
||||||
? dateTime.tz(timezone).format("LLL")
|
? moment(dateTime).tz(timezone).format("LLL")
|
||||||
: _createDateTimeRange(dateTime, timezone)
|
: _createDateTimeRange(dateTime, timezone)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -258,7 +257,7 @@
|
||||||
previewedTimezones.push({
|
previewedTimezones.push({
|
||||||
timezone: "Etc/UTC",
|
timezone: "Etc/UTC",
|
||||||
dateTime: options.time
|
dateTime: options.time
|
||||||
? dateTime.tz("Etc/UTC").format("LLL")
|
? moment(dateTime).tz("Etc/UTC").format("LLL")
|
||||||
: _createDateTimeRange(dateTime, "Etc/UTC")
|
: _createDateTimeRange(dateTime, "Etc/UTC")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue