Hi I have the following script. I want to change the year to 25 years from current year dynamically without hardcoding.
$(document).ready(function () {
var dateOfBirth = $('[data-id="dateOfBirth"]');
dateOfBirth.datepicker("option", "dateFormat", "ddmmyy");
dateOfBirth.prop("placeholder", "ddMMyyyy");
dateOfBirth.prop("aria-label", "ddMMyyyy");
var currentDate = new Date();
$('[data-id="dateOfBirth"]').datepicker({
format: 'ddMMyyyy',
autoclose: true,
endDate: "currentDate",
maxDate: currentDate,
showButtonPanel: false
}).change(dateChanged)
.on('changeDate', dateChanged);
});
function dateChanged(ev) {
$(this).datepicker('hide');
$(this).blur();
}
As of now it shows 10 years from current year when clicked on year drop down. PFB the screenshot for your references.
I am trying to find the solution and learn in the process. Thanks.