Skip to content

fix: fix truncated timestamps in sandbox logs and events and unify date formats#445

Merged
Kraci merged 1 commit into
mainfrom
fix-truncated-timestamps-in-sandbox-logs-and-events-en-1068
Jun 22, 2026
Merged

fix: fix truncated timestamps in sandbox logs and events and unify date formats#445
Kraci merged 1 commit into
mainfrom
fix-truncated-timestamps-in-sandbox-logs-and-events-en-1068

Conversation

@Kraci

@Kraci Kraci commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Consistent date/time/number formatting

What changed

Pinned locale-sensitive formatting to en-US across the dashboard so timestamps, dates, and numbers render identically for every viewer (the timezone offset still follows the user's local zone). This keeps fixed-width columns stable and avoids SSR/client hydration mismatches. Affected surfaces: logs, events tab, sandboxes list, templates list/detail, sandbox header (started/ended), stopped banner, chart tooltips, monitoring memory marker, billing add-on dialog, and the calendar labels.

Widened timestamp columns to fit the full stamp and stop truncation — logs 164px → 190px, events tab 174px → 190px.

Time-range picker boundary messages now use the picker's own YYYY/MM/DD HH:MM:SS format instead of a browser-localized string, so "cannot be before/after …" messages match the input fields and can be typed straight back in.

Refactors

  • Extracted a shared formatRelativeDateTime helper for the sandbox header (uses date-fns isToday/isYesterday), removing duplicated logic across started-at/ended-at.
  • Logs timestamp cell now uses the shared formatLocalLogStyleTimestamp (with a -- fallback for invalid timestamps).
  • Timezone resolution in the shared formatter is now opt-in (includeTimezone) to skip an expensive Intl call on hot virtualized rows.
Before After
Screenshot 2026-06-19 at 16 36 27 (1) Screenshot 2026-06-21 at 18 31 30
Screenshot 2026-06-19 at 18 18 29 (1) Screenshot 2026-06-21 at 18 31 42

@Kraci Kraci self-assigned this Jun 21, 2026
@linear-code

linear-code Bot commented Jun 21, 2026

Copy link
Copy Markdown

EN-1068

@cla-bot cla-bot Bot added the cla-signed label Jun 21, 2026
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 22, 2026 9:35am

Request Review

@Kraci Kraci force-pushed the fix-truncated-timestamps-in-sandbox-logs-and-events-en-1068 branch from 21f59f4 to 270a4d7 Compare June 21, 2026 16:46
@Kraci Kraci marked this pull request as ready for review June 21, 2026 16:52

drankou commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Giving changes you made and issue's context, could you quickly check and comment on #364 to make conflict resolution easier and avoid reintroducing similar bugs 🙏

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — mechanical locale unification + column-width fix, with a clean shared-formatter refactor.

Extended reasoning...

Overview

The PR pins locale-sensitive formatting to 'en-US' across the dashboard (logs, events table, sandboxes/templates lists, sandbox header, stopped banner, chart tooltips, monitoring memory marker, billing add-on dialog, calendar labels) so that timestamps, dates, and numbers render identically for every viewer and don't drift between SSR and client. Timestamp columns in logs (164→190px) and events (174→190px) are widened to stop truncation. Small refactors: the sandbox header's relative-day logic is replaced by the shared Timestamp component, the logs timestamp cell now goes through formatLocalLogStyleTimestamp (with a -- fallback for invalid input), and that formatter's timezone resolution becomes an opt-in (includeTimezone) to avoid an Intl call on hot virtualized rows. The time-range picker's boundary-violation messages now use the picker's own YYYY/MM/DD HH:MM:SS format instead of a localized browser string, so the suggested boundary can be pasted straight back into the input.

Security risks

None. No auth, crypto, network, or permission surfaces touched — this is purely display-layer formatting and a tiny pure-logic change in the time-range picker's validation message formatter.

Level of scrutiny

Low. The vast majority of hunks are mechanical toLocaleString()toLocaleString('en-US') / new Intl.DateTimeFormat(undefined, …)new Intl.DateTimeFormat('en-US', …) swaps. The non-mechanical pieces — extracting the timestamp component in ended-at.tsx, making includeTimezone opt-in on the shared formatter (callers that need it pass includeTimezone: true explicitly; others get timezonePart: null and a typed nullable in the return), and the time-range picker boundary formatter rewrite — are all small, self-contained, and easy to verify by reading the diff. Hot-path call sites (virtualized log rows, sandbox/template list cells) are correctly updated.

Other factors

The bug hunting system surfaced two findings, both non-blocking: a pre-existing truthy-guard issue on item.value in the chart tooltip that drops styling for value 0 (latent — no current caller hits it because the only consumer passes a formatter), and a static aria-label="Copy ended timestamp" that doesn't reflect the paused-vs-killed state of the sandbox. Neither warrants blocking; the inline comments make both visible to the author. Vercel preview deploy is green.

Comment thread src/features/dashboard/sandbox/header/ended-at.tsx
Comment thread src/ui/primitives/chart.tsx

Kraci commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

The only logic that was changed here is the use of unified US date and time formats. There are no changes to time zones. But yes, I’ll comment in this PR that I made that change. 👍

@huv1k

huv1k commented Jun 22, 2026

Copy link
Copy Markdown
Member

The only logic that was changed here is the use of unified US date and time formats. There are no changes to time zones. But yes, I’ll comment in this PR that I made that change. 👍

I wonder if we should make it as default one across the board instead of putting it everywhere.

Kraci commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

What do you have in mind? Shared utils for handling dates and times?

@Kraci Kraci force-pushed the fix-truncated-timestamps-in-sandbox-logs-and-events-en-1068 branch from 270a4d7 to 6e8a273 Compare June 22, 2026 09:33

Kraci commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

It would make sense. Let's do a follow up once we have timezones merged as well

@Kraci Kraci merged commit f629e33 into main Jun 22, 2026
13 checks passed
@Kraci Kraci deleted the fix-truncated-timestamps-in-sandbox-logs-and-events-en-1068 branch June 22, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants