Skip to content

Add DateOnly and TimeOnly string query parameter support #36511

Closed
@maxkoshevoi

Description

@maxkoshevoi

Describe the bug

DateOnly and TimeOnly should be represented as a string value when passed from a query (similar to DateTime's behavior).

image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: DuplicateResolved as a duplicate of another issueStatus: Resolvedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions