I am using bitframework 4 on nodejs. I cant get the DateTimePrompt to use locale 'en-GB' which has date format dd/mm (not mm/dd) I set locale in 3 places none worked:
adapter.processActivity(req, res, (context) => {
context.activity.locale = 'en-GB';
return myChatBot.run(context);
};
this.addDialog(new DateTimePrompt('startDatePrompt', undefined, 'en-GB'));
and in the webchat frame:
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({ token: token }),
locale: 'en-GB',
webSpeechPonyfillFactory
},
document.getElementById('webchat')
);
I just want the date parser to parse as dd/mm not mm/dd any thoughts?
Create a customer prompt with regex expression. This will give you the flexibility you need.
In your constructor use a TextPrompt and pass the promptvalidator
In the dialogstep with the prompt.
Since the promptvalidator will use turnState (works for me) to share the result with the dialogstep, we check for this in the next dialogStep
And the promptvalidator uses a regular expression to check for the right format. These regex expression tend to become complex. This one checks for dd/mm/yyyy. There are libraries available like https://regexlib.com/