DateOnly Support in Blazor DateRangePicker 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 DateRangePicker component, set the type parameter to DateOnly.

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

  • @using Syncfusion.Blazor.Calendars
    <p>Start Date : @Value</p>
    <p>End Date : @Value1</p>
    <SfDateRangePicker TValue="DateOnly" @bind-StartDate="@Value" @bind-EndDate="@Value1" Width="230px"></SfDateRangePicker>
        public DateOnly Value { get; set; } = new DateOnly(2022, 11, 12);
        public DateOnly Value1 { get; set; } = new DateOnly(2022, 11, 20);

    Blazor DateRangePicker with DateOnly