Last Updated: 20 Nov 2023 14:14 by Greg
Created on: 20 Nov 2023 14:14
Category: Form
Type: Bug Report
The Form autogenerated date picker with nullable DateOnly / TimeOnly value shows '1/1/2001' / '12:00 AM' instead of 'M/d/yyyy' / 'h:mm aa' like the standard TelerikDatePicker

My Nullable DateOnly field shows as 1/1/2001 - I would expect it to be a more sensible default. The problem is applicable only for the Form autogenerated DatePicker. The same issue is applicable for the TimeOnly type.



In the interim, as a viable workaround, you can utilize the FormItem Template and declare a TelerikDatePicker like this:

@using System.ComponentModel.DataAnnotations

<TelerikForm Model="@PersonModel">
                <label for="country">Date of Birth:</label>
                <TelerikDatePicker @bind-Value="@PersonModel.DOB" Width="200px" />

@code {
    private Person PersonModel { get; set; } = new Person() { DOB = null };

    public class Person
        [Display(Name = "Date of Birth")]
        public DateOnly? DOB { get; set; }