diff --git a/src/pages/api/thermostats/climate_setting_schedules/create.ts b/src/pages/api/thermostats/climate_setting_schedules/create.ts index 23a937b7..aeba015f 100644 --- a/src/pages/api/thermostats/climate_setting_schedules/create.ts +++ b/src/pages/api/thermostats/climate_setting_schedules/create.ts @@ -4,6 +4,7 @@ import { withRouteSpec } from "lib/middleware/with-route-spec.ts" import { climate_setting } from "lib/zod/climate_setting.ts" import { climate_setting_schedule } from "lib/zod/climate_setting_schedule.ts" import { timestamp } from "lib/zod/common.ts" +import { randomUUID } from "crypto" const jsonBody = z .object({ @@ -49,7 +50,7 @@ export default withRouteSpec({ workspace_id: req.auth.workspace_id, schedule_type, device_id, - name: name ?? "Schedule ${randomUUID().slice(5)}", + name: name ?? `Schedule ${randomUUID().slice(5)}`, schedule_starts_at: new Date(schedule_starts_at).toISOString(), schedule_ends_at: new Date(schedule_ends_at).toISOString(), ...climate_setting_for_schedule,