Open fitwist opened 2 years ago
It is because the code expected the request date to have a negative time zone offset
const dateTimeStart = new Date(Date.parse(agent.parameters.date.split('T')[0] + 'T' + agent.parameters.time.split('T')[1].split('-')[0] + timeZoneOffset));
and in your request, you have a positive timezone offset, 2022-01-26T10:00:00+03:00
, which leads to invalid date parsing.
You can fix this by modifying that line of code to accommodate both positive and negative timezone offset.
const dateTimeStart = new Date(Date.parse(agent.parameters.date.split('T')[0] + 'T' + agent.parameters.time.split('T')[1].split(/[-+]/)[0] + timeZoneOffset));
After following the video tutorial and copying code from this repo, I cannot make an apointment, though webhook execution is succesful.
{ "fulfillmentText": "I'm sorry, there are no slots available for Invalid Date.", "outputContexts": [] }
{ "responseId": "39a299fc-1528-4b63-b49b-e988baa0c1f2-c8e3f272", "queryResult": { "queryText": "set appointment for drivers license Friday 10am", "parameters": { "time": "2022-01-26T10:00:00+03:00", "date": "2022-01-28T12:00:00+03:00", "AppointmentType": "Driver License" }, "allRequiredParamsPresent": true, "fulfillmentText": "I'm sorry, there are no slots available for Invalid Date.", "fulfillmentMessages": [ { "text": { "text": [ "I'm sorry, there are no slots available for Invalid Date." ] } } ], "intent": { "name": "projects/test-chat-bot-app-321808/agent/intents/f2ee95db-be68-495a-90a8-6765e6dc413d", "displayName": "Schedule Appointment" }, "intentDetectionConfidence": 0.73469204, "diagnosticInfo": { "webhook_latency_ms": 82 }, "languageCode": "en", "sentimentAnalysisResult": { "queryTextSentiment": {} } }, "webhookStatus": { "message": "Webhook execution successful" } }