Skip to content
ConsoleMonster
Cmdlet

New-ConsoleDatePicker

Module
ConsoleMonster
Inputs
None
Outputs
ConsoleMonster.Interactive.DatePicker

Creates a persistent civil-date or inclusive range picker.

Syntax

New-ConsoleDatePicker
[-Disabled]
[-Key] <String>
[[-Label] <String>]
[-OnChange <ScriptBlock>]
[-Range]
[-Selection <DateSelectionOptions>]
[-TabIndex <Int32>]
[-ValidationMessage <String>]
[-Value <Object>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Uses Gregorian arithmetic with culture-aware labels. Arrows move the cursor, PageUp/PageDown change month, Ctrl+PageUp/PageDown change year, and Enter commits. In range mode Space anchors a range and Shift+arrows extend it. Bounds and unavailable dates reject a whole invalid range.

Examples

Example 1

New-ConsoleDatePicker -Key Window -Range -Value ([datetime]'2026-10-08')

Choose a maintenance range.

Parameters

-Disabled SwitchParameter optional
Disables editing and removes the input from keyboard focus traversal.
-Key String requiredposition: 0
Unique key in the application's state and final hashtable.
-Label String optionalposition: 1
Visible label; defaults to the name using the core control's labels.
-OnChange ScriptBlock optional
Runs once per committed edit on the owning input thread. Receives param($Value, $State) and injected $Value, $State and $Control. State is a hashtable; add or assign keys to write back. Output is discarded. Retains closure variables.
-Range SwitchParameter optional
Commits one inclusive DateRange.
-Selection DateSelectionOptions optional
Shared bounds, culture, today and marked-day model.
-TabIndex Int32 optional
Keyboard focus order. Equal values preserve layout declaration order.
-ValidationMessage String optional
Initial validation text displayed below the input.
-Value Object optional
Initial DateTime or DateRange; a scalar range default means Start=End.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.