I have a registration form where a user has to select a date.
1) I do not want a date entered into the field initially (Visually) when the form is loaded.
2) When the user clicks the Calendar, I want to display todays date as the initial value, the starting point for navigation purposes.
If I bind the "value" to todays date, then the field displays this date when the form is initially loaded, implicitly filling in the date.
I want the user to select a date explicitly and not to provide a "default" selected date.
This means I require the control to have an initial date.
Here is my code which does not achieve what I want:
@{
int year = DateTime.Now.Year;
DateTime firstDay = new DateTime(year-1 , 1, 1);
DateTime lastDay = new DateTime(year+1 , 12, 31);
Model.RegistrationDate = DateTime.Now;
}
<div id="datepicker-control">
<ejs-datepicker id="datepicker" min=@firstDay max=@lastDay value=@Model.RegistrationDate placeholder="Registration Date">ejs-datepicker>
div>