fix: show the local time for UTC+0 users

Merged
GG
19d ago
+32-5

Proposed changes (including videos or screenshots)

The local time is gated by utcOffset && Number.isInteger(utcOffset) && …. An offset of 0 is falsy, so users in UTC+0 (e.g. London in winter, Lisbon, Accra, or anyone who never set a timezone offset other than UTC) had no local time on:

  • the user card (UserCardWithData)
  • the user info panel (UserInfo), which on top of that rendered the short-circuited 0 as a stray "0" in the panel
  • the OAuth authorization card (CurrentUserDisplay)

The check is now typeof utcOffset === 'number' && Number.isInteger(utcOffset).

Extracted from #41650 (user information redesign), where @ivans-netto found and fixed this. Stacked on #42505; #41650 is stacked on top.

Issue(s)

CORE-1962

Steps to test or reproduce

  1. Have a user whose utcOffset is 0.
  2. Hover/click their name to open the user card, and open their user info.
  3. Before: no "Local time" field, and a lone "0" in the user info panel. After: "Local time" shows HH:mm (UTC 0).

Further comments

UserInfo.spec.tsx gains a UTC+0 case (local time shown, no stray "0"), rendered from the Default story with utcOffset={0} so the snapshots stay stable. It fails against the previous implementation.

Summary by CodeRabbit

  • Bug Fixes
    • Local time now appears on user cards, the user info panel, and OAuth authorization cards for UTC+0 and fractional-offset time zones.
    • The user info panel no longer displays a stray “0” for UTC+0 users.