Feature Request: Auto-select input type in InputDate<TValue> based on bound value type when Type not provided
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
Currently, the InputDate Blazor component requires developers to manually set the Type parameter to choose the HTML input type when using a TimeOnly or DateOnly bound value.
Many users are unaware the InputDate can be use for DateOnly and TimeOnly bound types, and input formatted for Date or Time only.
I have seen examples online from reputable Blazor courses dropping back to underly component so that it automatically selects the appropriate HTML input type attribute (date, datetime-local, time, etc.) based on the bound TValue (e.g., DateTime, DateTimeOffset, DateOnly, TimeOnly). If Type is not set, the component should infer:
- DateTime → Type=InputDateType.DateTimeLocal
- DateOnly → Type=InputDateType.Date
- TimeOnly → Type=InputDateType.Time
Type should remain as an override for advanced scenarios, but the default should be automatic selection based on TValue.
### Additional context
This feature would make InputDate more intuitive and safer for developers, reducing manual configuration and the risk of mismatch between the .NET type and the HTML input type.
Note: Alternatively a new component could be created with a names of InputDateTime / InputTime to allow this going forward.
Contributor guide
Assessment
This issue has not been assessed yet.