JQuery Datepicker minDate not working

I expect the next date range to start from 65 years ago and end 18 years ago. Instead, the minDate number is ignored and set to 10 years before the end date. There is no difference that I put as a value in minDate.

$(function() { $("#datepicker").datepicker({ changeMonth: true, changeYear: true, minDate: "-65y", maxDate: "-18y" }); });​ 
+4
source share
2 answers

This works for me;

 $("#txt_birthdate").datepicker({ yearRange: "-100:-18", changeMonth: true, changeYear: true, maxDate: new Date() }); 
+5
source

You can use yearRange for this;

 $('#datepicker').datepicker({ changeMonth: true, changeYear: true, yearRange: "-65y:-18y" }); 
+6
source

Source: https://habr.com/ru/post/1414115/


All Articles