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:
Methods
- WithBrowserFallback()
- Description: Adds a pattern attribute to the underlying input element. This helps gracefully degrade the user experience on older browsers by ensuring that the user selected value is still retrieved correctly.
- Returns: DateTimePicker (the current instance), allowing further chaining.
Properties
- DateTime
- Type: DateTime
- Description: Gets the current date and time value from the picker. This value is derived from the internal Moment value maintained by the component.
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.