Skip to content

fix(platform): display timestamps in user's local timezone#700

Merged
Israeltheminer merged 4 commits into
mainfrom
fix/document-timestamp-timezone
Mar 6, 2026
Merged

fix(platform): display timestamps in user's local timezone#700
Israeltheminer merged 4 commits into
mainfrom
fix/document-timestamp-timezone

Conversation

@Israeltheminer
Copy link
Copy Markdown
Collaborator

@Israeltheminer Israeltheminer commented Mar 6, 2026

Summary

  • Pass the browser's timezone (via Intl.DateTimeFormat) through all useFormatDate hooks so dates render in the user's local timezone instead of UTC
  • Add new CopyableTimestamp component that shows a formatted date with a copy button for the raw Unix timestamp
  • Replace TableDateCell with CopyableTimestamp in the documents table, using the long preset for better readability
  • Add Storybook stories for CopyableTimestamp covering all presets and edge cases

Closes #691

Test plan

  • Set browser timezone to a non-UTC zone (e.g., PST), upload a document, verify "Uploaded At" shows local time
  • Click copy — Unix timestamp should be copied to clipboard
  • Verify Storybook stories render correctly for all variants
  • Verify dates across the app (not just documents) now respect local timezone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added copyable timestamp component to display formatted dates with copy-to-clipboard functionality.
    • Enhanced documents table to display last modified timestamps with improved formatting and copy capability.
    • Integrated timezone awareness into date formatting across the application.

… UTC

Pass the browser's timezone (via Intl.DateTimeFormat) through all
useFormatDate hooks so dates render in the user's local timezone. Replace
TableDateCell with new CopyableTimestamp component in the documents table
that shows the long-format date and lets power users copy the raw Unix
timestamp. Add Storybook stories for the new component.

Closes #691
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

This change introduces timezone-aware timestamp display functionality to resolve UTC timezone issues in document timestamps. It adds a new CopyableTimestamp component that renders formatted dates with copy-to-clipboard capability, extends the useFormatDate hook to derive and apply the user's local timezone via Intl.DateTimeFormat, replaces the existing TableDateCell with CopyableTimestamp in the documents table configuration, and includes comprehensive Storybook stories demonstrating the component across various preset formats and layout contexts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: fixing timestamp display to use the user's local timezone instead of UTC.
Linked Issues check ✅ Passed The PR addresses the core requirement from issue #691: timestamps now display in user's local timezone via Intl.DateTimeFormat integration and CopyableTimestamp component adoption.
Out of Scope Changes check ✅ Passed All changes are directly related to the timezone fix objective: useFormatDate timezone support, CopyableTimestamp component, table integration, and Storybook stories.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/document-timestamp-timezone

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@services/platform/app/components/ui/data-display/copyable-timestamp.tsx`:
- Around line 65-67: The rendered timestamp lacks timezone context: update the
logic around formatted and titleText in copyable-timestamp.tsx to include
timezone information (use dateObj/timezone or Intl.DateTimeFormat with
timeZoneName or extend formatDate to accept a timezone flag) so both the
displayed formatted value (formatted) and the hover/title (titleText) append or
incorporate the time zone indicator (e.g., "UTC", "PST", or an offset)
consistent with the preset; locate usages of formatDate, formatted, titleText
and ensure the chosen timezone string is derived from dateObj or passed props
and concatenated into the final output.
- Line 133: The visually hidden copied state in the CopyableTimestamp component
should be placed in an ARIA live region so screen readers announce updates; find
the span rendering {copied && <span
className="sr-only">{tCommon('actions.copied')}</span>} and change it to an ARIA
live status (e.g., <span className="sr-only" role="status" aria-live="polite"
aria-atomic="true">...) so the "copied" text is announced when copied is
toggled.
- Around line 102-118: The copy button is always visible because it lacks
hidden-by-default + hover-reveal styles; update the parent span (the one using
cn('inline-flex items-center gap-1', ...)) to be a hover group (e.g., add a
"group" class) and change the button element (the <button> with class
"hover:bg-muted shrink-0 ...", aria-label using tCommon('actions.copy')) to be
hidden by default and become visible on group hover and on button focus (so
keyboard users can reveal it). Ensure you use the same unique identifiers: the
parent wrapper span where cn(...) is used and the copy button in
copyable-timestamp.tsx, and keep existing alignment logic (alignRight/className)
intact.
- Around line 59-66: The CopyableTimestamp component currently converts string
dates via new Date(date) (see dateObj/timestampMs/formatted/titleText) which
breaks formatDate's UTC-normalization; either tighten the prop type on
CopyableTimestamp to only accept number | Date (removing string) or, if string
support is required, stop converting string to a Date and pass the original
string into formatDate so it can apply its 'Z' UTC-normalization; update the
date prop type and usages (or the conditional creating dateObj) accordingly and
ensure timestampMs still yields a numeric string when date is a number or Date.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 11fd1e0d-5856-44f8-a327-73913ef730eb

📥 Commits

Reviewing files that changed from the base of the PR and between 6152263 and d26825d.

📒 Files selected for processing (4)
  • services/platform/app/components/ui/data-display/copyable-timestamp.stories.tsx
  • services/platform/app/components/ui/data-display/copyable-timestamp.tsx
  • services/platform/app/features/documents/hooks/use-documents-table-config.tsx
  • services/platform/app/hooks/use-format-date.ts

Comment thread services/platform/app/components/ui/data-display/copyable-timestamp.tsx Outdated
Comment thread services/platform/app/components/ui/data-display/copyable-timestamp.tsx Outdated
Comment thread services/platform/app/components/ui/data-display/copyable-timestamp.tsx Outdated
Timestamps with time info (long/time presets) now display the short
timezone abbreviation (e.g. CET, PST) directly in the rendered text
instead of only in the hover tooltip, making the timezone context
immediately visible without user interaction.
@Israeltheminer Israeltheminer merged commit 5df1fcd into main Mar 6, 2026
16 checks passed
@Israeltheminer Israeltheminer deleted the fix/document-timestamp-timezone branch March 6, 2026 15:07
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.

Bug: Document upload timestamp displayed in UTC instead of user's local timezone

1 participant