Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix(frontend): render the UTC hover timestamp in UTC, not local time (#7193)
Anas Khanef7b59bdcc0c
diff --git a/skyvern-frontend/src/util/timeFormat.test.ts b/skyvern-frontend/src/util/timeFormat.test.tsindex e36c90aed..f4e88c6c7 100644--- a/skyvern-frontend/src/util/timeFormat.test.ts+++ b/skyvern-frontend/src/util/timeFormat.test.ts@@ -137,4 +137,20 @@ describe("basicTimeFormat", () => {const result = basicTimeFormat("2026-03-04T18:30:00Z");expect(result).toContain(" at ");});++ test("renders the timestamp in UTC, not the viewer's local time", () => {+ // The tooltip is labeled "UTC", so it must show the UTC time regardless of+ // the machine's time zone. For an input carrying a Z the rendered time must+ // equal the UTC time (18:30), never a local-zone conversion of it.+ const result = basicTimeFormat("2026-03-04T18:30:00Z");+ expect(result).toBe("Wed, Mar 4, 2026 at 6:30:00 PM UTC");+ });++ test("treats a no-suffix timestamp as UTC before rendering", () => {+ // Backend returns naive UTC timestamps without 'Z'. normalizeUtcTimestamp+ // must run first so the tooltip matches the Z-suffixed instant.+ const withoutZ = "2026-03-04T18:30:00.000000";+ const withZ = "2026-03-04T18:30:00.000000Z";+ expect(basicTimeFormat(withoutZ)).toBe(basicTimeFormat(withZ));+ });});diff --git a/skyvern-frontend/src/util/timeFormat.ts b/skyvern-frontend/src/util/timeFormat.tsindex 0484d9211..11aba701b 100644--- a/skyvern-frontend/src/util/timeFormat.ts+++ b/skyvern-frontend/src/util/timeFormat.ts@@ -64,14 +64,22 @@ function compactLocalDateTime(time: string): string {}function basicTimeFormat(time: string): string {+ time = normalizeUtcTimestamp(time);+const date = new Date(time);++ // Render in UTC to match the "UTC" label; this is the hover companion to+ // basicLocalTimeFormat, which shows the same instant in the local time zone.const dateString = date.toLocaleDateString("en-US", {weekday: "short",year: "numeric",month: "short",day: "numeric",+ timeZone: "UTC",+ });+ const timeString = date.toLocaleTimeString("en-US", {+ timeZone: "UTC",});- const timeString = date.toLocaleTimeString("en-US");return `${dateString} at ${timeString} UTC`;}