DateOnly Support in Blazor DatePicker Component

29 Dec 20221 minute to read

The DateOnly type is a new type in .NET 6 that allows you to represent a date without a time component. To use it with the Blazor DatePicker component, set the type parameter to DateOnly.

Blazor DatePicker Component supports DateOnly type in .NET 7 and above version only, even though it introduced in .NET 6 itself due to serialization problem.

  • RAZOR
  • @using Syncfusion.Blazor.Calendars
    
    <p>Value is : @Value</p>
    
    <SfDatePicker TValue="DateOnly" @bind-Value="@Value"></SfDatePicker>
    
    
    @code
    {
        public DateOnly Value { get; set; } = new DateOnly(2022, 11, 12);
    }

    Blazor TimePicker with DateOnly