-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: add configurable timestamps to chat messages #10567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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
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:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| beforeEach(() => { | ||
| // Mock current date to 2026-01-09 14:30:00 | ||
| vi.useFakeTimers() | ||
| vi.setSystemTime(new Date("2026-01-09T14:30:00.000Z")) | ||
| }) |
There was a problem hiding this comment.
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.
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:
Changes
showTimestampssetting to GlobalSettings schemaformatTimestamputility functionScreenshots
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.
showTimestampssetting toglobalSettingsSchemainglobal-settings.ts.ChatRow.tsxto display timestamps in 24-hour format, with full date for previous days.UISettings.tsxandSettingsView.tsx.ExtensionStateContext.tsxto manageshowTimestampsstate.formatTimestampfunction informatTimestamp.tsfor formatting timestamps.formatTimestampinformatTimestamp.spec.ts.settings.json.This description was created by
for 58f707b. You can customize this summary. It will automatically update as commits are pushed.