From 1d0e4ee616a3ba7d2a364eae52c53a41c9ad7610 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Sat, 14 Mar 2026 13:01:22 -0700 Subject: [PATCH] Fix crash when Claude returns hours as object instead of string parseHoursString expected a string but Claude AI sometimes returns structured hours data as an object. Now normalizes to string first. Co-Authored-By: Claude Opus 4.6 --- portal/setup-wizard.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/portal/setup-wizard.html b/portal/setup-wizard.html index db07e72..ac5a756 100644 --- a/portal/setup-wizard.html +++ b/portal/setup-wizard.html @@ -2152,7 +2152,13 @@ console.log('Parsed address:', { addressLine1, city, state, zip }); // Parse hours into a 7-day schedule - const hoursSchedule = parseHoursString(biz.hours || ''); + // Claude may return hours as an object or string — normalize to string + let hoursRaw = biz.hours || ''; + if (typeof hoursRaw === 'object') { + // Try to flatten object to readable string (e.g. { monday: "9am-5pm", ... }) + try { hoursRaw = Object.entries(hoursRaw).map(([k, v]) => `${k} ${v}`).join(', '); } catch (e) { hoursRaw = ''; } + } + const hoursSchedule = parseHoursString(String(hoursRaw)); addMessage('ai', `

I found your restaurant information: