Speak the demo date naturally to the voice agent - #1
Merged
Merged
Conversation
The `date` dynamic variable was the raw ISO string, so ElevenLabs read it
aloud as "2026-09-19". Format it as "today, Saturday, September 19th"
("tomorrow, ..." the next day, plain weekday and date after that), computed
in the session's timezone with correct ordinal suffixes.
Only the `date` dynamic variable changes. session.context.date stays the ISO
string, so the dashboard and demoTime are unaffected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
datedynamic variable handed to ElevenLabs is the raw ISO string, so the agent reads it aloud as "two thousand twenty-six dash zero nine dash nineteen".Change
Format it for speech in
VoiceService.start(), wheredynamicVariables(session.context)is built:today, Saturday, September 19thwhen the date is todaytomorrow, Sunday, September 20thwhen it's tomorrowMonday, September 21stotherwiseToday/tomorrow are computed in the session's timezone (
call.business.timezone). Ordinal suffixes handle the 11th/12th/13th and 21st/22nd/23rd cases.Only the
datedynamic variable changes.session.context.datestays the ISODEMO_DATEstring, so the dashboard anddemoTime()are untouched.Notes
apps/api/src/refill/time.ts, self-contained with no new dependencies.npm run checkpasses: typecheck, 10/10 tests, web build. No existing test asserted ondynamicVariables.date.🤖 Generated with Claude Code