Fix time/datetime-local binding with seconds when there's no step attribute #41868
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #41731. This does appear to have been a regression in 6.0.
In 5.0, there was explicit JS-side logic to handle the case where an
<input type=time>
had nostep
attribute (which browsers interpret as "use whole number of minutes - no seconds"). We automatically stripped off any "seconds" part of the formatted string to make it value as far as the<input type=time>
is concerned. This behavior had been there from the very first days of@bind
. The implementation for this 5.0 behavior is here.During 6.0, we lost this specific behavior while fixing an issue related to keyboard inputs, because unfortunately it looks like we hadn't created a good E2E test case originally to show that the seconds-stripping behavior was needed. This PR restores the 5.0-and-earlier handling for cases where there's no
step
attribute.Risk: someone might be expecting to preserve the "seconds" value even in the absence of
step
. If a user doesn't try to edit the bound value, then the seconds would actually be preserved. However in that case the browser would already be showing a message saying the value is invalid, so it's unlikely the developer would be tolerating this, and it would be a bad UX even if they did.