I have this calendar and I want to disable all dates until current date:
In my html
<div>
<input asp-for="SelectedDate" id="SelectedDate"/>
</div>
In my js file
$(document).ready(function () {
var date = new Date();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
var minDate = new Date(currentMonth, currentDate, currentYear);
$("#SelectedDate").attr("min", minDate);
});
Backend:
[BindProperty]
public DateTime SelectedDate { get; set; }
I have to mention that I am using Razor Pages .Net Core.
The issue is that the min attribute is not working. I tried adding it in my html for a test like this but had no effect:
<input asp-for="SelectedDate" id="SelectedDate" min="05/11/2021"/>
Is there any workaround so that I can disable all dates untill the current date?
EDIT
