Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 9, 2026

This PR attempts to address Issue #10539 - adding timestamps to chat messages.

Summary

Implements configurable timestamps on chat messages as requested in the issue.

Features

Based on the requirements from @Gobi-one:

  • 24-hour format: Times are displayed in 24-hour format (e.g., 14:34)
  • Full date for old messages: Messages from previous days show the full date (e.g., "Jan 7, 14:34")
  • Configurable toggle: Can be enabled/disabled in Settings > UI Settings
  • Right-aligned position: Timestamps appear on the right side of the header row
  • Consistent styling: Uses the same text size as header row text

Changes

  • Added showTimestamps setting to GlobalSettings schema
  • Added state management in ExtensionStateContext
  • Created formatTimestamp utility function
  • Added toggle in UI Settings
  • Updated ChatRow component to display timestamps on key message types
  • Added translation strings
  • Added tests for the timestamp formatting utility

Screenshots

The timestamps will appear on the right side of message headers when enabled in Settings > UI > "Show timestamps on messages"

Feedback and guidance are welcome!


Important

This PR adds configurable timestamps to chat messages, allowing users to toggle the feature in settings, with timestamps displayed in a 24-hour format and full date for previous days.

  • Behavior:
    • Adds showTimestamps setting to globalSettingsSchema in global-settings.ts.
    • Updates ChatRow.tsx to display timestamps in 24-hour format, with full date for previous days.
    • Timestamps are right-aligned in the message header.
  • Settings:
    • Adds toggle for timestamps in UISettings.tsx and SettingsView.tsx.
    • Updates ExtensionStateContext.tsx to manage showTimestamps state.
  • Utilities:
    • Adds formatTimestamp function in formatTimestamp.ts for formatting timestamps.
    • Includes tests for formatTimestamp in formatTimestamp.spec.ts.
  • Translations:
    • Adds translation strings for timestamp settings in settings.json.

This description was created by Ellipsis for 58f707b. You can customize this summary. It will automatically update as commits are pushed.

Implements Issue #10539 - Adds the ability to display timestamps on chat messages.

Features:
- 24-hour format (14:34)
- Full date for messages from previous days (e.g., "Jan 7, 14:34")
- Configurable on/off toggle in UI Settings
- Timestamps appear on the right side of header rows
- Same styling as other header elements

Files changed:
- packages/types/src/global-settings.ts: Add showTimestamps setting
- src/shared/ExtensionMessage.ts: Add to ExtensionState
- webview-ui/src/context/ExtensionStateContext.tsx: Add state and setter
- webview-ui/src/utils/formatTimestamp.ts: New timestamp formatting utility
- webview-ui/src/components/settings/UISettings.tsx: Add toggle
- webview-ui/src/components/settings/SettingsView.tsx: Pass prop
- webview-ui/src/components/chat/ChatRow.tsx: Display timestamps
- webview-ui/src/i18n/locales/en/settings.json: Translation strings
- webview-ui/src/utils/__tests__/formatTimestamp.spec.ts: Tests
- webview-ui/src/components/settings/__tests__/UISettings.spec.tsx: Update tests
@roomote
Copy link
Contributor Author

roomote bot commented Jan 9, 2026

Rooviewer Clock   See task on Roo Cloud

This PR implements configurable timestamps on chat messages. The implementation is well-structured with proper schema updates, state management, and UI integration. Found one minor issue to address:

  • Tests in formatTimestamp.spec.ts are timezone-dependent and could fail in non-UTC environments

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Comment on lines +5 to +9
beforeEach(() => {
// Mock current date to 2026-01-09 14:30:00
vi.useFakeTimers()
vi.setSystemTime(new Date("2026-01-09T14:30:00.000Z"))
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are timezone-dependent and could fail in non-UTC environments. The mock time and test timestamps are specified in UTC, but formatTimestamp uses local time methods (getHours(), getDate()). In UTC+10, for example, 14:30 UTC becomes Jan 10, 00:30 local while 10:15 UTC becomes Jan 9, 20:15 local, making them different days and causing the "today's time" test to fail. Consider using getUTC*() methods in the implementation for consistent test behavior, or restructure tests to use timestamps that remain on the same calendar day across all timezones.

Fix it with Roo Code or mention @roomote and request a fix.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants