The device time resource, /ISAPI/System/time.
utcOffsetMinutes is set when timeZone parses; platformType when the
device sends it. Parsing throws an Error when timeMode, localTime or
timeZone is missing and an IsapiError on a failing <ResponseStatus>.
Read through a stubbed fetch
Read through a stubbed fetch
import { assertEquals } from "@std/assert"; import { resolvesNext, spy } from "@std/testing/mock"; import { request } from "../request.ts"; import { deviceTime } from "./device-time.ts"; const fetch = spy(resolvesNext([ new Response( "<Time><timeMode>platform</timeMode><platformType>EZVIZ</platformType>" + "<localTime>2026-10-22T11:33:52</localTime>" + "<timeZone>CST+3:00:00</timeZone></Time>", ), ])); const time = await request({ baseUrl: "http://192.0.2.21", username: "admin", password: "hunter2", fetch, }, deviceTime); assertEquals(time.platformType, "EZVIZ"); assertEquals(time.utcOffsetMinutes, -180); assertEquals(fetch.calls[0].args[0], "http://192.0.2.21/ISAPI/System/time");