DateTimePicker
Description
The DateTimePicker component provides a native browser widget for selecting date and time values. It is designed for situations where precise date-time input is required and leverages the browser's built-in capabilities. Under the hood, it converts the provided or selected DateTime value to a string format ("yyyy-MM-ddTHH:mm") for proper display and parsing. Use this component when you need to allow users to pick both date and time with built-in validation and customizable constraints. It is part of the Components group in the Tesserae UI library.
Usage
Instantiate a DateTimePicker using the fluent interface via the static helper method in Tesserae.UI. You can provide an initial DateTime value to set a default value, or use various chainable methods to set additional properties like step increment, minimum or maximum dates, or browser fallback behavior.
Below is an example that creates a basic DateTimePicker:
API reference
public class DateTimePicker : MomentPickerBase<DateTimePicker, DateTime>A form input for picking a single date together with a time-of-day.
- Namespace
- Tesserae
- Inheritance
- MomentPickerBase<DateTimePicker, DateTime> → DateTimePicker
Constructors
| Name | Description |
|---|---|
| DateTimePicker | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| DateTime | Gets or sets the date time. |
Methods
| Name | Description |
|---|---|
| WithBrowserFallback | Adds the pattern attribute to the underlying input element for graceful degradation when retrieving the user selected value on older browsers. |
Samples
DateTimePicker Variants
This sample illustrates the creation of a DateTimePicker with a few configurations like a default future date, step increment, and range limits.