DateOnly Support in Blazor Calendar Component

26 Dec 20231 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 Calendar component, set the type parameter to DateOnly.

Blazor Calendar 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>Date : @Value</p>
        
    <SfCalendar TValue="DateOnly" @bind-Value="@Value"></SfCalendar>
    
    @code
    {
        public DateOnly Value { get; set; } = new DateOnly(2022, 11, 12);
    }

    Blazor Calendar with DateOnly