FIX: ensures preview is correctly computing timezone for current user (#9758)

This also fixes a related bug with timezones on displayed date when in calendar range.
This commit is contained in:
Joffrey JAFFEUX
2020-05-12 21:30:41 +02:00
committed by GitHub
parent d9f5499f3a
commit e990d8adce
2 changed files with 49 additions and 5 deletions

View File

@ -89,7 +89,14 @@ export default class LocalDateBuilder {
previewedTimezones.push({
timezone: this._zoneWithoutPrefix(this.localTimezone),
current: true,
formated: this._createDateTimeRange(localDate, this.time)
formated: this._createDateTimeRange(
DateWithZoneHelper.fromDatetime(
localDate.datetime,
localDate.timezone,
this.localTimezone
),
this.time
)
});
if (
@ -180,10 +187,12 @@ export default class LocalDateBuilder {
);
if (inCalendarRange && sameTimezone) {
return localDate.datetime.calendar(
moment.tz(this.localTimezone),
this._calendarFormats(this.time ? this.time : null)
);
return localDate
.datetimeWithZone(this.localTimezone)
.calendar(
moment.tz(localDate.timezone),
this._calendarFormats(this.time ? this.time : null)
);
}
}