Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Adding min and max date to blazor inputdate field

$
0
0

I am currently sitting with a quite frustrating issue here, which I thought should be quite easy to solve.

I have a blazor inputdate field where I have added a min and max date, but I am not seeing the desired end result.This is how my code is setup:

<InputDate @bind-Value="@ViewModel.DateTo" class="form-control"      min="@datetoMin.ToString("yyyy-MM-dd")"       max="@datetoMax.ToString("yyyy-MM-dd")" />@code{    DateTime datetoMax = DateTime.Now.AddDays(60);    DateTime datetoMin = DateTime.Now.AddBusinessDays(-5);}

The min and Max part is working fine but for some reason it looks like this on Chrome but not firefox:

enter image description here

"dd-mm-2023" Why is there a 2023 and not a yyyy? I noticed it looks correct when I only use either min or max but the combination of both adds the 2023 at the end.

Is there a way to fix this or just make the field empty until the user picks a date?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>