Skip to content

fix: show a date for future activity timestamps - #100

Open
nvtoan0201-swe wants to merge 1 commit into
CopilotKit:mainfrom
nvtoan0201-swe:fix/future-relative-times
Open

nvtoan0201-swe wants to merge 1 commit into
CopilotKit:mainfrom
nvtoan0201-swe:fix/future-relative-times

Conversation

@nvtoan0201-swe

Copy link
Copy Markdown

What changed

relativeDate compared Date.now() - timestamp and 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.tsx into apps/mobile/src/relative-date.ts (re-exported from ui.tsx, so existing imports keep working) and is covered in apps/mobile/test/relative-date.test.ts with an injected now.

Verification

  • pnpm test — 279 pass, 0 fail (3 new tests)
  • pnpm lint
  • pnpm 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.

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

No deployments
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.

1 participant