DateTimeEdit
The DateTimeEdit component renders a date/time picker for Dataverse date and time columns. It supports date-only, time-only, and combined date and time modes.
<DateTimeEdit ColumnName="ppp_birthdate" />
Editor Type
Set EditorType to choose between DateTimeEditorType.DateTime (default), DateTimeEditorType.DateOnly, or DateTimeEditorType.TimeOnly.
<!-- Date and time (default) -->
<DateTimeEdit ColumnName="ppp_birthdate" EditorType="DateTimeEditorType.DateTime" />
<!-- Date only -->
<DateTimeEdit ColumnName="ppp_birthdate" EditorType="DateTimeEditorType.DateOnly" />
<!-- Time only -->
<DateTimeEdit ColumnName="ppp_birthdate" EditorType="DateTimeEditorType.TimeOnly" />
Disabling Dates
Use the DisabledDateFunc parameter to provide a function that returns true for dates that should be disabled in the calendar picker.
<DateTimeEdit ColumnName="ppp_birthdate"
DisabledDateFunc="@(date => date > DateTime.Today)" />
DateTimeEdit
Here is an example that demonstrates the use of a DateTimeEdit component.
DateTimeEdit (Extended Properties)
This demonstrates the most common properties that are availabe to set on the DateTimeEdit.
** Note ** Future dates are disabled based on the DisabledDateFunc.
DateTimeEdit Class
Parameters
Name | Type | Default | Description |
|---|---|---|---|
ChildContent | RenderFragment? | Child content of the component | |
ColumnName | string | Column logical name to bind the editor to from the table record. | |
Description | string? | Description to be displayed in the tooltip. | |
Disabled | bool? | Should the editor be disabled. | |
DisabledDateFunc | Func<DateTime, bool>? | Function to know if a specific day must be disabled. | |
DisplayLabelWhenAvailable | bool | True | Specifies whether to display a lable if available. |
DisplayTooltipWhenAvailable | bool | True | Specifies whether to display a tooltip if available. |
DisplayValidationErrorMessage | bool | True | Should a validation error message be displayed when the component fails validation? |
EditorType | DateTimeEditorType? | Determines which editors are displayed for the column. | |
IsVisible | bool | True | Is the editor visible. |
Label | string? | Text to be displayed as a label for the editor. | |
ReadOnly | bool? | Should the editor be read-only. | |
Required | bool? | Should the value be required. | |
Value | DateTime? | Value of the column. |
Name:
ChildContentType:
RenderFragment?
Description:
Child content of the component
Name:
ColumnNameType:
string
Description:
Column logical name to bind the editor to from the table record.
Name:
DescriptionType:
string?
Description:
Description to be displayed in the tooltip.
Name:
DisabledType:
bool?
Description:
Should the editor be disabled.
Name:
DisabledDateFuncType:
Func<DateTime, bool>?
Description:
Function to know if a specific day must be disabled.
Name:
DisplayLabelWhenAvailableType:
bool
Default:
True
Description:
Specifies whether to display a lable if available.
Name:
DisplayTooltipWhenAvailableType:
bool
Default:
True
Description:
Specifies whether to display a tooltip if available.
Name:
DisplayValidationErrorMessageType:
bool
Default:
True
Description:
Should a validation error message be displayed when the component fails validation?
Name:
EditorTypeType:
DateTimeEditorType?
Description:
Determines which editors are displayed for the column.
Name:
IsVisibleType:
bool
Default:
True
Description:
Is the editor visible.
Name:
LabelType:
string?
Description:
Text to be displayed as a label for the editor.
Name:
ReadOnlyType:
bool?
Description:
Should the editor be read-only.
Name:
RequiredType:
bool?
Description:
Should the value be required.
Name:
ValueType:
DateTime?
Description:
Value of the column.
Events
Name | Type | Description |
|---|---|---|
ValueChanged | EventCallback<ColumnValueBase> | Gets or sets a callback that updates the bound value. |
Name:
ValueChangedType:
EventCallback<ColumnValueBase>
Description:
Gets or sets a callback that updates the bound value.
Methods
Name | Parameters | Type | Description |
|---|---|---|---|
GetValidationErrors | List<string> | Returns a collection of the current validation errors. |
Name:
GetValidationErrorsType:
List<string>
Description:
Returns a collection of the current validation errors.
