date time always in the past. Why?
# support
m
VAPI always sending callers date time in the past such as 2023 or 2024. Had to write several AI modules in MAKE to handle it but still some dates are not handled so how to fix the date time in VAPI to send current date time if caller said March 20th.
v
Hi there! I understand you're having issues with VAPI sending dates in the past. This is a known issue that can happen for several reasons: 1. **Dynamic Variable Issues**: The date/time variables might not be rendering correctly in your prompts. 2. **Timezone Configuration**: If your timezone settings aren't properly configured, VAPI might interpret dates incorrectly. 3. **Incorrect Date Calculations**: The system might be miscalculating relative dates. To fix this and ensure VAPI uses the current date when a caller mentions "March 20th", try these solutions: ### Use Liquid Syntax in Your Prompts Add these dynamic variables early in your prompts:
Copy code
liquid
Current date: {{ "now" | date: "%B %d, %Y", "America/Chicago"}}
Current time: {{ "now" | date: "%I:%M %p", "America/Chicago"}}
Day of the week: {{ "now" | date: "%A", "America/Chicago"}}
### Include Both Date and Day of Week Explicitly include both to help the LLM understand the context:
Copy code
liquid
The current date is {{ "now" | date: "%A, %B %d, %Y", "America/New_York"}} and the time is {{ "now" | date: "%I:%M %p", "America/New_York"}}.
### Handle User Timezone Properly Make sure to capture and utilize the user's timezone:
Copy code
liquid
"I noted that your local timezone is UTC{{timezone_offset}}. When you say 'book for tomorrow', I'll schedule it based on your local time."
### Implement Confirmation Logic After processing dates, confirm back to the user:
Copy code
liquid
"Alright, I've scheduled your appointment for {{appointment_date}} at {{appointment_time}}, according to your local time zone. Please confirm if this works for you."
Let me know if you need help implementing any of these solutions! 😊 Sources: - [Dynamic Variable Issues](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336772166330351646) - [Timezone Configuration](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336995626604564551)
m
That worked. Thank you