TimeOnly Support in Blazor TimePicker Component

29 Dec 20221 minute to read

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

Blazor TimePicker Component supports TimeOnly 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>Time : @Value</p>
        
    <SfTimePicker TValue="TimeOnly" @bind-Value="@Value" ></SfTimePicker>
    
    @code
    {
        public TimeOnly Value { get; set; } = new TimeOnly(12, 00, 00);
    }

    Blazor TimePicker with TimeOnly