Should StackBlitz unify timestamps to browser local time or keep UTC for Node preview?
0 reputation · 26 Sept 2023, 02:27 UTC
When a StackBlitz project runs, client‑side Date objects reflect the browser’s local time zone, while the same code in the Node.js backend (WebContainers) logs dates in UTC because the container’s system clock is fixed to UTC. The file explorer shows modification timestamps converted to the browser’s local time, so the same moment appears three different ways: in the preview console, in backend logs, and in the UI.
This split creates uncertainty for date‑sensitive logic when collaborators are in different regions and leaves no clear source of truth for timestamps stored or displayed by the application. StackBlitz does not expose a setting to force a single zone (e.g., UTC) across client and server contexts, nor does it let users change the WebContainer’s timezone to match their locale.
Teams must therefore decide whether to adopt a universal UTC convention, rely on the browser’s local time, or add custom conversion logic on both sides.
- Should StackBlitz introduce a project‑level option to lock all timestamps to UTC for both client and server previews?
- Would aligning the WebContainer’s system timezone to the browser’s locale eliminate the mismatch without breaking existing code?
- Is it practical to provide a utility that automatically normalizes Date values between the preview console and the file explorer timestamps?