Unplanned
Last Updated: 20 Nov 2023 14:14 by Greg

My Nullable DateOnly field shows as 1/1/2001 - I would expect it to be a more sensible default. The problem applies to all autogenerated DatePickers (like the Grid's filter DatePicker and the Form). The same issue is applicable to the TimeOnly struct.

 

===ADMIN EDIT===

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">
    <FormValidation>
        <DataAnnotationsValidator></DataAnnotationsValidator>
    </FormValidation>
    <FormItems>
        <FormItem>
            <Template>
                <label for="country">Date of Birth:</label>
                <TelerikDatePicker @bind-Value="@PersonModel.DOB" Width="200px" />
            </Template>
        </FormItem>
    </FormItems>
</TelerikForm>

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

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