[Blazor] Add support for TimeSpan to BindConverter
See original GitHub issueDescribe the bug
Before the update to version 3.1.0, I can use <input type="time" @bind-value="@MyTimespan"/>
after the update, it fails with the error "cannot convert from ‘System.TimeSpan’ to ‘System.DateTime’ "
I dont quiet understand, why you have removed this type of usage.
To Reproduce
https://blazorfiddle.com/s/uk47jfsz
Further technical details
Functional: v3.0.0 Not functional: v3.1.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:14 (6 by maintainers)
Top Results From Across the Web
How to bind input of type time with blazor
You cannot bind a TimeSpan directly to an input in Blazor, but you can use a property to convert it to/from a string....
Read more >ASP.NET Core Blazor forms and input components
The Blazor framework supports forms and provides built-in input components: ... Add the following line to the project's _Imports.razor file:.
Read more >How do I bind input of type time with Blazor?
You can bind an input of type time in Blazor by using the @bind property to the time value and @bind:format property to...
Read more >Building Components Manually via RenderTreeBuilder
In this post, I'm going to show you how you can build components manually using Blazors RenderTreeBuilder. Instead of using the traditional ...
Read more >Blast Off with Blazor: Build a search-as-you-type box
In this post, we build a quick search box that filters our images.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m in the same situation as him.
It gives the error “cannot convert from ‘System.TimeSpan’ to ‘System.DateTime’” inside the .razor (same error as him) AND it will give the error “cannot implicitly convert type ‘System.DateTimeOffset?’ to ‘System.TimeSpan’” inside the .razor.g.cs
I’d like to point out this is in no way an “offset” to a datetime, this is just a time field. There is no notion of “date” here.
@mathisloge not entirely sure. The API at the callsite hasn’t changed since before 3.0 RTMed.