Skip to content

fix(leaderboard): localize timestamps safely after hydration - #87

Merged
Muyideen-js merged 1 commit into
SPulse-Org:mainfrom
juan-fernandez-gotherlabs:agent/leaderboard-timezone-hydration
Aug 8, 2026
Merged

fix(leaderboard): localize timestamps safely after hydration#87
Muyideen-js merged 1 commit into
SPulse-Org:mainfrom
juan-fernandez-gotherlabs:agent/leaderboard-timezone-hydration

Conversation

@juan-fernandez-gotherlabs

Copy link
Copy Markdown
Contributor

Fixes #80

/claim #80

Summary

  • normalize Unix timestamps supplied in either seconds or milliseconds;
  • consolidate the duplicated and malformed timestamp helpers while preserving
    their public exports;
  • render leaderboard timestamps through one hydration-safe component;
  • use deterministic UTC markup for SSR and the first client render, then switch
    to the viewer's locale and IANA timezone after mount;
  • keep exact machine-readable values in semantic <time dateTime="...">
    elements;
  • add regression coverage for SSR, real React hydration, multiple timezones,
    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 navigator from shared utilities is unsafe
during SSR.

LocalizedTimestamp uses the same en-US/UTC snapshot on the server and the
first browser render. Its effect then resolves navigator.languages and the
browser'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;
  • clean-patch application against commit
    74a2491333f1ef0151e819a80d6514967a949498 — passed.

No production dependency is added.

@juan-fernandez-gotherlabs
juan-fernandez-gotherlabs marked this pull request as ready for review August 6, 2026 14:59
@Muyideen-js
Muyideen-js merged commit 9c4a726 into SPulse-Org:main Aug 8, 2026
@juan-fernandez-gotherlabs

Copy link
Copy Markdown
Contributor Author

/claim #80

@juan-fernandez-gotherlabs

Copy link
Copy Markdown
Contributor Author

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 /claim #80 when it was created, and I repeated the command in a PR comment after merge, but Opire did not register the claim: the dashboard for juan-fernandez-gotherlabs still shows 0 claimed and $0 to receive.

Opire appears to retain the bounty under the repository former name, Steller-StellarPulse-org/StellarPulse, while GitHub now redirects that repository to SPaulse-Org/SPulse. That transfer may have interrupted the bot integration.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants