diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index d526bad94b1..d03182caa0e 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -1710,7 +1710,6 @@ export const UserInfoHeader: React.FC<{ withDisplayName: true, }); const displayName = (member as RoomMember).rawDisplayName; - console.log("booop", timezoneInfo); return (
@@ -1738,13 +1737,15 @@ export const UserInfoHeader: React.FC<{ {presenceLabel} - {timezoneInfo && - - - {timezoneInfo?.friendly ?? ""} - - - } + {timezoneInfo && ( + + + + {timezoneInfo?.friendly ?? ""} + + + + )} userIdentifier} border={false}> {userIdentifier} diff --git a/test/components/views/right_panel/UserInfo-test.tsx b/test/components/views/right_panel/UserInfo-test.tsx index 891d60b5012..ff4514cdfcb 100644 --- a/test/components/views/right_panel/UserInfo-test.tsx +++ b/test/components/views/right_panel/UserInfo-test.tsx @@ -100,6 +100,7 @@ let mockRoom: Mocked; let mockSpace: Mocked; let mockClient: Mocked; let mockCrypto: Mocked; +const origDate = global.Date.prototype.toLocaleString; beforeEach(() => { mockRoom = mocked({ @@ -240,10 +241,14 @@ describe("", () => { }); it("renders user timezone if set", async () => { + // For timezone, force a consistent locale. + jest.spyOn(global.Date.prototype, "toLocaleString").mockImplementation(function (_locale, opts) { + return origDate.call(this, "en-US", opts); // eslint-disable-line @typescript-eslint/no-invalid-this + }); mockClient.doesServerSupportExtendedProfiles.mockResolvedValue(true); mockClient.getExtendedProfileProperty.mockResolvedValue("Europe/London"); renderComponent(); - await expect(screen.findByText(/\d\d:\d\d (am|pm)/)).resolves.toBeInTheDocument(); + await expect(screen.findByText(/\d\d:\d\d (AM|PM)/)).resolves.toBeInTheDocument(); }); it("renders encryption info panel without pending verification", () => {