Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker in Grid popup bound to a DateOnly field does not show the field value #8124

Open
IvanDanchev opened this issue Jan 24, 2025 · 0 comments

Comments

@IvanDanchev
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant