Completed
Last Updated: 04 Mar 2021 08:22 by ADMIN
Release 2.23.0
Robert
Created on: 20 Feb 2020 09:16
Category: DatePicker
Type: Bug Report
3
Deleting the date with the keyboard when bound to non-nullable DateTime leaves incorrect validation messages and state after a valid date is selected

Delete the input, choose a date from the dropdown. The issue is that the first picker remains invalid, while it is valid, a keyboard interaction with the input is required to clear the invalid state.

Reproducible:

@using System.ComponentModel.DataAnnotations;

    <EditForm Model="ModelData">
        <DataAnnotationsValidator />
        <ValidationSummary />
        <br /><br />
        <span>Not nullable</span> @ModelData.Date<br />
        <Telerik.Blazor.Components.TelerikDatePicker @bind-Value="ModelData.Date" Min="DateTime.MinValue" Max="DateTime.MaxValue"></Telerik.Blazor.Components.TelerikDatePicker><br /><br />
        <span>Nullable</span> @ModelData.Date2<br />
        <Telerik.Blazor.Components.TelerikDatePicker @bind-Value="ModelData.Date2" Min="DateTime.MinValue" Max="DateTime.MaxValue"></Telerik.Blazor.Components.TelerikDatePicker><br /><br />
    </EditForm>

@code  {

    public MyModel ModelData { get; set; }

    protected override void OnInitialized()
    {
        ModelData = new MyModel();
    }

    public class MyModel
    {
        public string Name { get; set; }

        [Required(ErrorMessage = "Non nullable required")]
        public DateTime Date { get; set; } = DateTime.Today;

        [Required(ErrorMessage = "Nullable required")]
        public DateTime? Date2 { get; set; } = DateTime.Today;
    }
}

2 comments
ADMIN
Svetoslav Dimitrov
Posted on: 23 Feb 2021 12:41

Hello,

For the time being, you can use the Nullable DateTime object (DateTime?) as a workaround. Let us know if you keep experiencing the same issue when using nullable DateTime.

Regards,
Svetoslav Dimitrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

ADMIN
Marin Bratanov
Posted on: 01 May 2020 07:22

Hi Robert,

This one somehow fell through the cracks when updating statuses, I think we fixed it for 2.9.0 as part of the following one so I am marking this as a duplicate: https://feedback.telerik.com/blazor/1456610-unexpected-years-validation-behavior-on-keyboard-input. If you keep having issues with this, let's look into them further.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.