fix: show a date for future activity timestamps - #100
Open
nvtoan0201-swe wants to merge 1 commit into
Open
nvtoan0201-swe wants to merge 1 commit into
nvtoan0201-swe wants to merge 1 commit into
Conversation
relativeDate computed Date.now() - timestamp and treated any value under a minute, including hours in the future, as Just now. Clock skew of a few seconds should stay Just now, but further future values now fall back to a date. Move the pure helper into relative-date.ts so it is covered by node:test.
This branch has not been deployed
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.
What changed
relativeDatecomparedDate.now() - timestampand returned "Just now" for anything under a minute — including timestamps hours in the future (server/device clock skew, scheduled dates). Those now fall back to a date label, while a few seconds of skew still reads "Just now".The pure helper moved from
apps/mobile/src/ui.tsxintoapps/mobile/src/relative-date.ts(re-exported fromui.tsx, so existing imports keep working) and is covered inapps/mobile/test/relative-date.test.tswith an injectednow.Verification
pnpm test— 279 pass, 0 fail (3 new tests)pnpm lintpnpm typecheck(root + mobile)Integration limits
Only the timestamp label changes; no device/simulator run.
AI assistance was used to prepare this change; I reviewed the code, tests and checks above.