fix: fix truncated timestamps in sandbox logs and events and unify date formats#445
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
21f59f4 to
270a4d7
Compare
|
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 🙏 |
There was a problem hiding this comment.
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.
|
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. |
|
What do you have in mind? Shared utils for handling dates and times? |
270a4d7 to
6e8a273
Compare
|
It would make sense. Let's do a follow up once we have timezones merged as well |
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