Skip to content
ConsoleMonster
Class

DatePrompt

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

Asks for one civil DateTime or, with Range, one inclusive DateRange. Cancellation follows the shared prompt policy.

Inheritance

Usage

Explore 25 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 12

Constructors

public DatePrompt(string title) #

Creates a date question.

Parameters

title string required

Methods

public override string Describe(object value) #

The answer as text, for the summary line left in the scrollback.

Parameters

value object required
The answer.

Returns

string The text.
public override object Show(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #

Asks the question and returns the answer.

Parameters

options ConsoleMonster.Interactive.InteractiveOptions? = null optional
Options; null uses InteractiveOptions.Default.
cancellationToken System.Threading.CancellationToken = default optional
Cancels the prompt.

Returns

object The answer.

Exceptions

Properties

public bool Range { get; set; } #

Returns one DateRange instead of a DateTime.

public DateSelectionOptions Selection { get; set; } #

Date bounds, unavailable dates, culture and marked-day data.

Extension Methods

public static DatePrompt Default(DatePrompt datePrompt, object value) #

Sets Prompt<object>.Default: The default answer: pre-selected, accepted with Enter, and returned in non-interactive sessions.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance.
value object required
The value.

Returns

DatePrompt The same instance.

Examples

// C# initializer or property    // C# fluent
datePrompt.Default = value;      Ui.DatePrompt().Default(value);
public static DatePrompt Description(DatePrompt datePrompt, string? value) #

Sets Prompt<object>.Description: Help text under the question.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance.
value string? required
The value.

Returns

DatePrompt The same instance.

Examples

// C# initializer or property      // C# fluent
datePrompt.Description = value;    Ui.DatePrompt().Description(value);
public static DatePrompt ParameterName(DatePrompt datePrompt, string? value) #

Sets Prompt<object>.ParameterName: The parameter that supplies this value non-interactively (-Domain, --domain); named in the non-interactive error message.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance.
value string? required
The value.

Returns

DatePrompt The same instance.

Examples

// C# initializer or property        // C# fluent
datePrompt.ParameterName = value;    Ui.DatePrompt().ParameterName(value);
Range 2 overloads
public static DatePrompt Range(DatePrompt datePrompt, bool value) #

Sets DatePrompt.Range: Returns one DateRange instead of a DateTime.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance.
value bool required
The value.

Returns

DatePrompt The same instance.

Examples

// C# initializer or property    // C# fluent
datePrompt.Range = value;        Ui.DatePrompt().Range(value);
public static DatePrompt Range(DatePrompt datePrompt) #

Sets DatePrompt.Range to true.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance to configure.

Returns

DatePrompt The same instance.
Selection 2 overloads
public static DatePrompt Selection(DatePrompt datePrompt, DateSelectionOptions value) #

Sets DatePrompt.Selection: Date bounds, unavailable dates, culture and marked-day data.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance.
value ConsoleMonster.Interactive.DateSelectionOptions required
The value.

Returns

DatePrompt The same instance.

Examples

// C# initializer or property    // C# fluent
datePrompt.Selection = value;    Ui.DatePrompt().Selection(value);
public static DatePrompt Selection(DatePrompt datePrompt, Action<DateSelectionOptions> configure) #

Configures DatePrompt.Selection in place (creating it when not set): Date bounds, unavailable dates, culture and marked-day data.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance.
configure System.Action<ConsoleMonster.Interactive.DateSelectionOptions> required
Configures the value.

Returns

DatePrompt The same instance.
public static DatePrompt Title(DatePrompt datePrompt, string value) #

Sets Prompt<object>.Title: The question.

Parameters

datePrompt ConsoleMonster.Interactive.DatePrompt required
The instance.
value string required
The value.

Returns

DatePrompt The same instance.

Examples

// C# initializer or property    // C# fluent
datePrompt.Title = value;        Ui.DatePrompt().Title(value);