validation - How to disply the calender before 3 months and after 3 months only from current date onwords using jquery -
i want calendar when calendar shows it's show current date , want able see in calendar before 3 months date , after 3 months date only.
i getting current date , selecting date.
input type date
$(document).ready(function() { $( "#txttrtdtpreaprvlsubn" ).datepicker({ changemonth: true, changeyear: true, mindate: '-3m', maxdate: '+3m', }); });
<input type="date" id="txttrtdtpreaprvlsubn" placeholder="treatment date">
$(...).datepicker not function error comming
based on current date, calculate min date , max date , set these options date picker.
like below:
$(document).ready(function() { var date1 = new date(); var date2 = new date(); $("#from").datepicker().datepicker("setdate", new date()); var munimumdate = new date(date1.setmonth(date1.getmonth() - 3)); var maximumdate = new date(date2.setmonth(date2.getmonth() + 3)); $("#from").datepicker({ dateformat: 'dd-mm-yy', mindate : munimumdate, maxdate : maximumdate }); });
Comments
Post a Comment