javascript - Disable JQuery datepicker dates by picking a date from another datepicker -
2 datepickers fromdate , todate
my requirement select fromdate , todate should not more 30 days selected fromdate, when pick fromdate should enable next 30 days in todate datepicker.
i tried implement facility these datepickers not working
//from date $("#txttfromdateteacherdailyreport").datepicker( { changemonth : true, changeyear : true, dateformat : "dd/mm/yy", maxdate : '0', beforeshow : function() { jquery(this).datepicker( 'option', 'maxdate',jquery('#txtttodateteacherdailyreport').val()); }, }).datepicker("setdate", "0"); //to date $("#txtttodateteacherdailyreport").datepicker( { changemonth : true, changeyear : true, dateformat : "dd/mm/yy", maxdate :'0', beforeshow : function() { jquery(this).datepicker( 'option', 'mindate', jquery( '#txttfromdateteacherdailyreport').val()); }, }).datepicker("setdate", "0");
please me rid of this.
jquery datepicker - force range selected date
http://codepen.io/anon/pen/venjwd
// datepicker $( "#from" ).datepicker({ defaultdate: "+1d", changemonth: false, numberofmonths: 1, mindate: "+1d", onclose: function(selecteddate) { $( "#to" ).datepicker( "option", "mindate", selecteddate ); // change value of second parameter needs // 7 = 1 week, 14 = 2 weeks, etc $( "#to" ).datepicker( "option", "maxdate", new_date(selecteddate, 30) ); } }); // datepicker $( "#to" ).datepicker({ defaultdate: "+1w", changemonth: false, numberofmonths: 1 }); // not edit below line function new_date(old_date, days_after) { var month = parseint(old_date.substring(0, 2))-1; var day = parseint(old_date.substring(3, 5)); var year = parseint(old_date.substring(6, 10)); var mydate = new date(year, month, day); mydate.setdate(mydate.getdate() + days_after); var newmonth = mydate.getmonth()+1; var newday = mydate.getdate(); var newyear = mydate.getfullyear(); var output = newmonth + "/" + newday + "/" + newyear; return output; } // created by: rafael leonidas cepeda
Comments
Post a Comment