diff --git a/frontend/src/manufacturing/ProvisioningWizard.jsx b/frontend/src/manufacturing/ProvisioningWizard.jsx index 0593a0e..a067492 100644 --- a/frontend/src/manufacturing/ProvisioningWizard.jsx +++ b/frontend/src/manufacturing/ProvisioningWizard.jsx @@ -749,7 +749,7 @@ function StepVerify({ device, onVerified }) { setTimedOut(false); setError(""); - const startTime = new Date().toISOString(); + const startTime = Date.now(); intervalRef.current = setInterval(async () => { try { @@ -761,7 +761,12 @@ function StepVerify({ device, onVerified }) { if (hbData.heartbeats && hbData.heartbeats.length > 0) { const latest = hbData.heartbeats[0]; const receivedAt = latest.received_at; - if (receivedAt && receivedAt > startTime) { + // SQLite stores datetime as "YYYY-MM-DD HH:MM:SS" (UTC, no T/Z suffix). + // Replace the space with T and append Z so Date.parse() treats it as UTC. + const receivedMs = receivedAt + ? Date.parse(receivedAt.replace(" ", "T") + "Z") + : NaN; + if (!isNaN(receivedMs) && receivedMs > startTime) { clearInterval(intervalRef.current); clearTimeout(timeoutRef.current); // Promote device status to provisioned