Error with timepicker when load times

My code:

<SfTimePicker TValue="TimeSpan" @bind-Value="@myTime" Format="@FormatType"></SfTimePicker>

@code {

    public string FormatType = "hh:mm:ss";

    TimeSpan myTime = new TimeSpan(08, 25, 00);

}


I get this error in the browser in the developers tools console

Error: 

[2023-10-28T18:55:48.659Z] Error: System.InvalidOperationException: Input string was not in a correct format.

   at Syncfusion.Blazor.Internal.Intl.GetDateFormat[T](T date, String format, String culture)

   at Syncfusion.Blazor.Calendars.SfTimePicker`1.FormatDateValue(TValue timeValue, String formatString)

   at Syncfusion.Blazor.Calendars.SfTimePicker`1.FormatValueAsString(TValue formatValue)

   at Syncfusion.Blazor.Inputs.SfInputTextBase`1.PreRender()

   at Syncfusion.Blazor.Inputs.SfInputTextBase`1.OnParametersSetAsync()

   at Syncfusion.Blazor.Calendars.SfTimePicker`1.OnParametersSetAsync()

   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()


Some help? thank you so much!



1 Reply

YS Yohapuja Selvakumaran Syncfusion Team October 31, 2023 03:56 PM UTC

Hi Fercap,


We have created a sample based on the shared code snippet, and we did not encounter any exceptions during component rendering or while selecting the time. Please refer to the attached sample and gif image for your reference.




To assist us in resolving this issue more effectively, we kindly request that you modify the shared sample to replicate the problem. If possible, could you also provide us with a replication procedure to help us investigate the issue further?


Additionally, it would be helpful if you could share the Syncfusion Package version that you are currently using. This information will aid us in better understanding and addressing your specific situation.


Regards,

Yohapuja S


Attachment: Timespan_6ffecba5.zip

Loader.
Up arrow icon