FIX: compares timezones on utc offset and not name (#6672)

This commit is contained in:
Joffrey JAFFEUX 2018-11-27 12:36:19 +01:00 committed by GitHub
parent 54c599c7a3
commit 75dac31323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -121,7 +121,9 @@
};
const _applyFormatting = (dateTime, displayedTimezone, options) => {
const sameTimezone = displayedTimezone === moment.tz.guess();
const sameTimezone =
moment.tz(displayedTimezone).utcOffset() ===
moment.tz(moment.tz.guess()).utcOffset();
const inCalendarRange = dateTime.isBetween(
moment().subtract(2, "days"),
moment().add(2, "days")

View File

@ -97,6 +97,17 @@ test("default format - no time specified", assert => {
"it appends creator timezone if watching user timezone is different"
);
});
freezeDateAndZone(advance(1), "Europe/Vienna", () => {
html = generateHTML({ date: advance(3) });
transformed = $(html).applyLocalDates();
assert.equal(
transformed.text().trim(),
"June 23, 2018",
"it doesnt append timezone if different but with the same utc offset"
);
});
});
test("today", assert => {