Datepicker minDate today and maxDate 31 Dec Next year
问题 Try to limit the date selection between today and 31st Dec of next year. $(function() { $('.public-holiday-date-pick').datepicker({ minDate: '0', yearRange: '-0:+1', maxDate: ??? hideIfNoPrevNext: true }); }); How should I define maxDate ? tried few things like '31 12 +1', or just 'last day of next year', did not work. 回答1: 1) First get today's using var today = new Date(); 2) Similarly set the lastDate as below var lastDate = new Date(today.getFullYear() +1, 11, 31); The value in lastDate