Closed
Description
Describe the bug
DateOnly
and TimeOnly
should be represented as a string value when passed from a query (similar to DateTime
's behavior).
To Reproduce
- Create an api action with following parameters
public void Foo([FromQuery] DateOnly date, [FromQuery] TimeOnly time, [FromQuery] DateTime dateTime)
. - See what arguments it expects.
Expected result
I can pass date
and time
as two string values (similar to how I can pass dateTime
as a string).
Actual result
I need to specify all DateOnly
and TimeOnly
properties individually (see screenshot above)
Further technical details
- ASP.NET Core .NET 6 RC1
- IDE: VS 2022 Preview 4.0
Workaround
- Custom model binder + Swagger configuration
- Custom type converter (Swagger will see it automatically). https://github.com/maxkoshevoi/DateOnlyTimeOnly.AspNet/tree/main/DateOnlyTimeOnly.AspNet/Converters/Type