Skip to content

{Date, Time}Only Querystring building APIs for Blazor #35567

Closed
@TanayParikh

Description

@TanayParikh

Background and Motivation

This is an extension of #34115 to support DateOnly and TimeOnly, given we already support DateTime.

Proposed API

namespace Microsoft.AspNetCore.Components
{
    public static class NavigationManagerExtensions
    {
+       public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, DateOnly value)
+       public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, DateOnly? value)
+       public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, TimeOnly value)
+       public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, TimeOnly? value)
    }
}

Usage Examples

[Parameter, SupplyParameterFromQuery]
public DateOnly OnlyTheDate { get; set; }

[Parameter, SupplyParameterFromQuery]
public TimeOnly OnlyTheTime { get; set; }

Alternative Designs

N/A, extension of existing API.

Risks

Concept count / complexity. Other than that, it's a fairly straightforward change that a user has requested already.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedapi-approvedAPI was approved in API review, it can be implementedarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions