mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:50:00 +08:00
FIX: compares timezones on utc offset and not name (#6672)
This commit is contained in:
parent
54c599c7a3
commit
75dac31323
|
@ -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")
|
||||
|
|
|
@ -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 doesn’t append timezone if different but with the same utc offset"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("today", assert => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user