I am using the tag in my Blazor app. But how can i format the date using my own culture ?
<InputDate class="form-control" @bind-Value="@ValidDate" @bind-Value:culture="nl-BE" @bind-Value:format="dd/MM/yyyy" />
regards Dieter
The answer is @bind-Value:format
, like so
@page "/"
<EditForm Model="@CurrentPerson">
<InputDate @bind-Value="@CurrentPerson.DateOfBirth" @bind-Value:format="dd/MM/yyyy"/>
</EditForm>
@code
{
Person CurrentPerson = new Person();
public class Person
{
public DateTime DateOfBirth { get; set; } = DateTime.Now;
}
}
There is also the option of using bind-Value:culture
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With