DateTimePrompt class

Prompts a user to enter a datetime expression.

Extends

Remarks

By default the prompt will return to the calling dialog a DateTimeResolution[].

Constructors

DateTimePrompt(string, PromptValidator<DateTimeResolution[]>, string)

Creates a new DateTimePrompt instance.

Properties

defaultLocale

The prompts default locale that should be recognized.

id

Unique ID of the dialog. Sets the unique ID of the dialog.

telemetryClient

Gets the telemetry client for this dialog. Sets the telemetry client for this dialog.

Inherited Properties

EndOfTurn

Gets a default end-of-turn result.

Inherited Methods

beginDialog(DialogContext, PromptOptions)

Called when a prompt dialog is pushed onto the dialog stack and is being activated.

configure(Record<string, unknown>)

Fluent method for configuring the object.

continueDialog(DialogContext)

Called when a prompt dialog is the active dialog and the user replied with a new activity.

endDialog(TurnContext, DialogInstance, DialogReason)

When overridden in a derived class, performs clean up for the dialog before it ends.

getConverter(string)
getVersion()

An encoded string used to aid in the detection of bot changes on re-deployment.

onDialogEvent(DialogContext, DialogEvent)

Called when an event has been raised, using DialogContext.emitEvent(), by either the current dialog or a dialog that the current dialog started.

repromptDialog(TurnContext, DialogInstance)

Called when a prompt dialog has been requested to re-prompt the user for input.

resumeDialog(DialogContext, DialogReason, any)

Called when a prompt dialog resumes being the active dialog on the dialog stack, such as when the previous active dialog on the stack completes.

Constructor Details

DateTimePrompt(string, PromptValidator<DateTimeResolution[]>, string)

Creates a new DateTimePrompt instance.

new DateTimePrompt(dialogId: string, validator?: PromptValidator<DateTimeResolution[]>, defaultLocale?: string)

Parameters

dialogId

string

Unique ID of the dialog within its parent DialogSet or ComponentDialog.

validator

PromptValidator<DateTimeResolution[]>

(Optional) validator that will be called each time the user responds to the prompt.

defaultLocale

string

(Optional) locale to use if TurnContext.activity.locale is not specified. Defaults to a value of en-us.

Property Details

defaultLocale

The prompts default locale that should be recognized.

defaultLocale: string | undefined

Property Value

string | undefined

id

Unique ID of the dialog. Sets the unique ID of the dialog.

string id

Property Value

string

The Id for the dialog.

Remarks

This will be automatically generated if not specified.

telemetryClient

Gets the telemetry client for this dialog. Sets the telemetry client for this dialog.

BotTelemetryClient telemetryClient

Property Value

BotTelemetryClient

The BotTelemetryClient to use for logging.

Inherited Property Details

EndOfTurn

Gets a default end-of-turn result.

static EndOfTurn: DialogTurnResult

Property Value

Remarks

This result indicates that a dialog (or a logical step within a dialog) has completed processing for the current turn, is still active, and is waiting for more input.

Inherited From Dialog.EndOfTurn

Inherited Method Details

beginDialog(DialogContext, PromptOptions)

Called when a prompt dialog is pushed onto the dialog stack and is being activated.

function beginDialog(dc: DialogContext, options: PromptOptions): Promise<DialogTurnResult>

Parameters

dc
DialogContext

The DialogContext for the current turn of the conversation.

options
PromptOptions

Optional. PromptOptions, additional information to pass to the prompt being started.

Returns

Promise<DialogTurnResult>

A Promise representing the asynchronous operation.

Remarks

If the task is successful, the result indicates whether the prompt is still active after the turn has been processed by the prompt.

Inherited From Prompt.beginDialog

configure(Record<string, unknown>)

Fluent method for configuring the object.

function configure(config: Record<string, unknown>): this

Parameters

config

Record<string, unknown>

Configuration settings to apply.

Returns

this

The Configurable after the operation is complete.

Inherited From Configurable.configure

continueDialog(DialogContext)

Called when a prompt dialog is the active dialog and the user replied with a new activity.

function continueDialog(dc: DialogContext): Promise<DialogTurnResult>

Parameters

dc
DialogContext

The DialogContext for the current turn of conversation.

Returns

Promise<DialogTurnResult>

A Promise representing the asynchronous operation.

Remarks

If the task is successful, the result indicates whether the dialog is still active after the turn has been processed by the dialog. The prompt generally continues to receive the user's replies until it accepts the user's reply as valid input for the prompt.

Inherited From Prompt.continueDialog

endDialog(TurnContext, DialogInstance, DialogReason)

When overridden in a derived class, performs clean up for the dialog before it ends.

function endDialog(_context: TurnContext, _instance: DialogInstance, _reason: DialogReason): Promise<void>

Parameters

_context

TurnContext

The context object for the turn.

_instance
DialogInstance

Current state information for this dialog.

_reason
DialogReason

The reason the dialog is ending.

Returns

Promise<void>

Remarks

Derived dialogs that need to perform logging or cleanup before ending should override this method. By default, this method has no effect.

The DialogContext calls this method when the current dialog is ending.

See also

Inherited From Dialog.endDialog

getConverter(string)

function getConverter(_property: string): Converter | ConverterFactory

Parameters

_property

string

The key of the conditional selector configuration.

Returns

The converter for the selector configuration.

Inherited From Configurable.getConverter

getVersion()

An encoded string used to aid in the detection of bot changes on re-deployment.

function getVersion(): string

Returns

string

Unique string which should only change when dialog has changed in a way that should restart the dialog.

Remarks

This defaults to returning the dialogs id but can be overridden to provide more precise change detection logic. Any dialog on the stack that has its version change will result in a versionChanged event will be raised. If this event is not handled by the bot, an error will be thrown resulting in the bots error handler logic being run.

Returning an empty string will disable version tracking for the component all together.

Inherited From Dialog.getVersion

onDialogEvent(DialogContext, DialogEvent)

Called when an event has been raised, using DialogContext.emitEvent(), by either the current dialog or a dialog that the current dialog started.

function onDialogEvent(dc: DialogContext, e: DialogEvent): Promise<boolean>

Parameters

dc
DialogContext

The dialog context for the current turn of conversation.

e
DialogEvent

The event being raised.

Returns

Promise<boolean>

True if the event is handled by the current dialog and bubbling should stop.

Inherited From Dialog.onDialogEvent

repromptDialog(TurnContext, DialogInstance)

Called when a prompt dialog has been requested to re-prompt the user for input.

function repromptDialog(context: TurnContext, instance: DialogInstance): Promise<void>

Parameters

context

TurnContext

(xref:botbuilder-core.TurnContext), context for the current turn of conversation with the user.

instance
DialogInstance

(xref:botbuilder-dialogs.DialogInstance), the instance of the dialog on the stack.

Returns

Promise<void>

A Promise representing the asynchronous operation.

Inherited From Prompt.repromptDialog

resumeDialog(DialogContext, DialogReason, any)

Called when a prompt dialog resumes being the active dialog on the dialog stack, such as when the previous active dialog on the stack completes.

function resumeDialog(dc: DialogContext, _reason: DialogReason, _result?: any): Promise<DialogTurnResult>

Parameters

dc
DialogContext

The DialogContext for the current turn of the conversation.

_reason
DialogReason

An enum indicating why the dialog resumed.

_result

any

Optional, value returned from the previous dialog on the stack. The type of the value returned is dependent on the previous dialog.

Returns

Promise<DialogTurnResult>

A Promise representing the asynchronous operation.

Remarks

If the task is successful, the result indicates whether the dialog is still active after the turn has been processed by the dialog.

Inherited From Prompt.resumeDialog