fix(leaderboard): normalize timezone display in timestamp helpers - #88
Open
praveenchand-2005 wants to merge 1 commit into
Open
Conversation
- Remove duplicate toTimestampMs/formatDate/formatTime/timeAgo definitions left by a bad merge; the duplicate toTimestampMs returned Date.now() for invalid input instead of the invalid sentinel. - Route formatDate/formatTime through the shared toTimestampMs so seconds and milliseconds are normalized identically everywhere. - Make formatEventTime use Intl.DateTimeFormat consistently with the rest of the file. - Add coverage for formatEventTime including invalid-input handling.
Author
|
/claim #80 |
Author
Test & Check Evidence (verified locally)Vitest (full suite):
PR status: Changes can be cleanly merged. Repo has no CI workflow configured (Checks 0), so verification is provided via the local suite above. Summary of fix: Removed merge-conflict duplicate definitions in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the inconsistent timezone display on the leaderboard by repairing the timestamp helpers.
The original
helpers.tscontained merge-conflict artifacts:toTimestampMs- the first copy returnedDate.now()for invalid input (so bad timestamps rendered as "now"), the second was the correct normalizer.formatDate,formatTime,timeAgo,formatEventTimedefinitions.formatDateused a hardcoded inline threshold (4_102_444_800) instead of the sharedtoTimestampMsnormalizer, so seconds/millisecond handling could diverge from every other call site.Changes
formatDate/formatTimenow route through the single sharedtoTimestampMs, so a Unix-seconds timestamp and the same instant in milliseconds render identically in the viewer's local timezone with a timezone label.formatEventTimenow usesIntl.DateTimeFormatconsistently with the rest of the file (previously mixedtoLocaleString).formatEventTime, including invalid-input handling.Test evidence
vitest run- 15 files / 217 tests passing:Verified with
tsc --noEmit- no errors.