Skip to content

Display relative timestamps with periodic refresh - #17

Merged
KallynGowdy merged 2 commits into
devfrom
claude/gracious-einstein-jsxnos
Sep 11, 2026
Merged

KallynGowdy merged 2 commits into
devfrom
claude/gracious-einstein-jsxnos

Conversation

@KallynGowdy

Copy link
Copy Markdown
Contributor

Description

Changes the message timestamp display from absolute time formats (e.g., "Today 14:30", "Yesterday 09:15") to relative time formats (e.g., "2 minutes ago", "3 days ago") that refresh periodically.

Key changes:

  • Replaced custom date/time logic with Intl.RelativeTimeFormat API for consistent, locale-aware relative time formatting
  • Added a relativeTime() utility function that formats timestamps relative to a reference time, supporting both 'long' and 'narrow' styles
  • Implemented periodic refresh (every 60 seconds) via useEffect to keep relative times current
  • Moved absolute date/time to a hover tooltip (title attribute) for reference without cluttering the UI
  • Removed unused today() and yesterday() utility functions

Dependencies:

  • Uses native Intl.RelativeTimeFormat (widely supported in modern browsers)
  • Caches formatter instances for performance

Checklist:

  • I have read and understood the Contribution policy.
  • Added unit tests for relativeTime() utility covering various time units and styles
  • Tests pass (npm test)

https://claude.ai/code/session_01UQphQjunoV9ToZDZRgePG2

Adds a relativeTime() helper (src/app/utils/time.ts) built on
Intl.RelativeTimeFormat and uses it in the shared Time component so
messages/events show "2 days ago", "10 minutes ago", etc. instead of a
fixed clock time. The absolute date/time is kept as a hover tooltip,
and the label refreshes every minute so it stays current.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UQphQjunoV9ToZDZRgePG2
Feed post cards had no timestamp at all. Add the shared Time
component next to the sender's name, using the post group's most
recent event timestamp and the same relativeTime() formatting used
elsewhere.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UQphQjunoV9ToZDZRgePG2
@KallynGowdy
KallynGowdy merged commit 12715cc into dev Sep 11, 2026
4 checks passed
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