fix(leaderboard): localize timestamps safely after hydration - #87
Conversation
|
/claim #80 |
|
Hi @Muyideen-js — thank you again for merging this contribution. I am following up on the $200 Opire bounty attached to issue #80. This PR included Opire appears to retain the bounty under the repository former name, I also see that PR #89 was merged shortly before #87. Could you please confirm which contribution the bounty creator selected, or direct me to the reward creator so Opire can resolve the missing claim? I am not asking to bypass the creator selection—only to make sure the repository transfer did not prevent the legitimate claim from being recorded. Relevant links:
Thank you. |
Fixes #80
/claim #80
Summary
their public exports;
to the viewer's locale and IANA timezone after mount;
<time dateTime="...">elements;
relative timestamps, invalid inputs, and leaderboard integration.
Why a component is needed
The leaderboard page is a client component, but Next.js may still pre-render it
on the server. Formatting immediately with server defaults can put server-local
text in the HTML, while reading
navigatorfrom shared utilities is unsafeduring SSR.
LocalizedTimestampuses the sameen-US/UTC snapshot on the server and thefirst browser render. Its effect then resolves
navigator.languagesand thebrowser's IANA timezone. This avoids hydration mismatches without exposing
browser globals to shared helpers.
Validation
npm test— 16 test files, 218/218 tests passed;npx tsc --noEmit— passed;npm run build— passed, including the statically generated leaderboard;git diff --check— passed;74a2491333f1ef0151e819a80d6514967a949498— passed.No production dependency is added.