Skip to content

Feature Request: Auto-select input type in InputDate<TValue> based on bound value type when Type not provided #64023

@jhogan05

Description

@jhogan05

Is there an existing issue for this?

  • 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 <input type='time> because they are unaware that the Input does this.

Describe the solution you'd like

Enhance the InputDate 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions