Unplanned
Last Updated: 24 Jan 2025 15:13 by E
E
Created on: 24 Jan 2025 15:13
Category: Grid
Type: Bug Report
0
DatePicker in Grid popup bound to a DateOnly field does not show the field value

Bug report

When ParseFormats is set in the DatePicker editor used in the Grid popup, the picker does not show the field value to which it is bound.

Reproduction of the problem

  1. Add a DateOnly? field to the model:

public DateOnly? OrderDate { get; set; }

  1. Bind a Grid column to the field.
  2. Set the default value in the DataSource:
.Model(model =>
{
    model.Id(p => p.OrderID);
    model.Field(p => p.OrderDate).DefaultValue(new DateOnly());
})
  1. Configure Popup editing in the Grid.
  2. Add a DateOnly.cshtml editor in EditorTemplates:
@model DateOnly?

@(Html.Kendo().DatePickerFor(m => m).ParseFormats(new string[] { "MM/dd/yyyy" }).HtmlAttributes(new { title = Html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName("") }))

Current behavior

When editing a record. The value of the OrderDate field is not displayed in the DatePicker.
If you remove the ParseFormats option from the DatePicker, it shows the value as expected.

Expected/desired behavior

The field value should be displayed in the picker, even when ParseFormats is set.

Environment

  • Kendo UI version: 2024.4.1112
  • Browser: All
0 comments