$(function () {
var minimumdate = document.getElementById("PageContent_hdnVdate").value;
//var currentDate = new Date();
var currentDate = new Date();
$("#<%=txt_installationDate.ClientID %>").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd/M/yy",
// maxDate: "+12m",
maxDate: currentDate,
minDate: minimumdate,
showOn: "button",
showOn: "both",
buttonImage: "../img/calendar.png",
buttonImageOnly: true,
onClose: function (selectedDate) {
$("#<%=txt_installationDate.ClientID %>").datepicker("option", "minDate", selectedDate);
}
});
});
Loading

Amira BedhiafiRank #601 · 4K reputationPosted Jan 25, 2025, 1:45 PM EST
$(function () { var minimumdate = new Date(); var futureDate = new Date(minimumdate.getFullYear(), 3, 1); $("#").datepicker({ changeMonth: true, changeYear: true, dateFormat: "dd/M/yy", minDate: futureDate, maxDate: "+12m", showOn: "button", showOn: "both", buttonImage: "../img/calendar.png", buttonImageOnly: true, onClose: function (selectedDate) { $("#").datepicker("option", "minDate", selectedDate); } }); });Try to set
minDateto the desired future date in your case 1st April 2025 and setmaxDateto allow selection of dates beyond April 2025 if you need it :Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Jan 25, 2025, 1:45 PM EST
HI Selva,
You can try the below updated code:
$(function () { var currentDate = new Date(); var year = currentDate.getFullYear(); // Set April 1st of the current year as the minimum selectable date var minimumDate = new Date(year, 3, 1); // Month is 0-indexed, so 3 = April $("#").datepicker({ changeMonth: true, changeYear: true, dateFormat: "dd/M/yy", minDate: minimumDate, // Minimum date is April 1st of this year maxDate: "+12m", // Allow up to 12 months in the future showOn: "both", buttonImage: "../img/calendar.png", buttonImageOnly: true, onClose: function (selectedDate) { $("#").datepicker("option", "minDate", selectedDate); } }); });