fix: show the local time for UTC+0 users
Merged
GG
19d ago+32+32+01234567890123456789-5-5-0123456789
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-circuited0as 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)
Steps to test or reproduce
- Have a user whose
utcOffsetis0. - Hover/click their name to open the user card, and open their user info.
- 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.