Skip to content

fix: localize and normalize timestamps across leaderboard views - #36

Open
CrazyShout wants to merge 3 commits into
Steller-StellarPulse-org:mainfrom
CrazyShout:atlas/fix-leaderboard-timezone
Open

fix: localize and normalize timestamps across leaderboard views#36
CrazyShout wants to merge 3 commits into
Steller-StellarPulse-org:mainfrom
CrazyShout:atlas/fix-leaderboard-timezone

Conversation

@CrazyShout

@CrazyShout CrazyShout commented Jul 11, 2026

Copy link
Copy Markdown

Summary

  • Normalize Unix-second and JavaScript-millisecond timestamps through shared formatters.
  • Keep the event model's timestamp contract in Unix seconds at the Soroban boundary.
  • Use the viewer's locale and time zone, with a short time-zone label to remove ambiguity.
  • Record and display the leaderboard's successful refresh time.
  • Preserve a compact time layout in the market activity feed while fixing the existing millisecond value being multiplied by 1,000 again.
  • Reject malformed, empty, non-finite, and invalid-date ledger close times so unactionable events never reach UI state.
  • Add deterministic locale, unit-normalization, event-boundary, and refresh-state tests.

Root cause

The existing helper assumed every value was Unix seconds and hard-coded en-US. Soroban events were stored as milliseconds, but the activity view multiplied them by 1,000 again. The leaderboard also did not expose or render a refresh timestamp, so there was no consistent timestamp display to localize.

User impact

Leaderboard and activity timestamps now represent the correct instant, follow the user's browser locale and time zone, and identify that time zone explicitly. Failed leaderboard refreshes do not display a misleading new timestamp.

Validation

  • Focused timestamp, event, leaderboard hook, and table tests: 78/78 passed.
  • Full suite: 170/172 passed. The two remaining failures are pre-existing Navbar assertions that look for StellarPulse while the component renders Stellar Pulse.
  • tsc --noEmit reports only the pre-existing src/app/layout.tsx Google Font configuration error (weight is required).
  • git diff --check passes.

The repository currently omits frontend/package.json; local validation used a temporary manifest reconstructed from the committed package-lock.json. The manifest is not part of this PR.

Closes #27

@CrazyShout

Copy link
Copy Markdown
Author

/claim #27

@CrazyShout

Copy link
Copy Markdown
Author

Follow-up pushed in e36b532 after a current-state acceptance audit:

  • normalizes ledgerClosedAt to Unix seconds at the event boundary
  • keeps the shared formatters defensive for both second and millisecond inputs
  • preserves a compact activity-feed layout
  • adds an explicit short time-zone label
  • adds deterministic event-boundary and compact-time coverage

Validation after the update:

  • focused tests: 66/66 passed
  • full suite: 158/160 passed; the only failures remain the two pre-existing Navbar brand-text assertions documented in the PR body
  • git diff --check passed

@Muyideen-js

Copy link
Copy Markdown
Collaborator

@CrazyShout fix file conflict

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.

[wave] Fix inconsistent timezone display in leaderboard

2 participants