question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Blazor] Add support for TimeSpan to BindConverter

See original GitHub issue

Describe 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:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
adugasBIDcommented, Dec 20, 2019

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.

1reaction
pranavkmcommented, Apr 29, 2020

@mathisloge not entirely sure. The API at the callsite hasn’t changed since before 3.0 RTMed.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found