Skip to content

Automate browser based workflows with AI

[SKY-48] Update TOTP Entry Remaining Display Time (#4845)

Aaron Perezacc530acfaaa
diff --git a/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts b/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts
index 66d41c94c..8fa6df206 100644
--- a/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts
+++ b/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts
@@ -54,7 +54,18 @@ function useVerificationCodeAlert({
return;
}
- const startTime = new Date(pollingStartedAt).getTime();
+ // Normalize to UTC: backend sends ISO 8601 without timezone suffix
+ // (e.g., "2026-02-21T12:00:00.000000" from Python's datetime.utcnow().isoformat())
+ // JavaScript interprets timestamps without "Z" as local time, causing incorrect calculations
+ let normalizedTimestamp = pollingStartedAt;
+ if (
+ !pollingStartedAt.endsWith("Z") &&
+ !pollingStartedAt.includes("+") &&
+ !pollingStartedAt.includes("-", 10)
+ ) {
+ normalizedTimestamp = pollingStartedAt + "Z";
+ }
+ const startTime = new Date(normalizedTimestamp).getTime();
const timeoutMs = VERIFICATION_TIMEOUT_MINS * 60 * TIMER_TICK_MS;
const updateTimer = () => {