jquery - Disable time outside minTime and maxTime range -
i tried link 2 jquery-ui timepicker.
var time = new date(); $('#from').timepicker({ onclose: function(datetext, inst) { var startdatetextbox = $('#to'); if (startdatetextbox.val() != '') { var teststartdate = new date(startdatetextbox.val()); var testenddate = new date(datetext); if (teststartdate > testenddate) startdatetextbox.val(datetext); } else { startdatetextbox.val(datetext); } }, onselect: function(datetext){ var time = new date($(this).datetimepicker('gettime').gettime()); $('#to').timepicker('option', 'mintime',time); } }); $('#to').timepicker({ onclose: function(datetext, inst) { var startdatetextbox = $('#from'); if (startdatetextbox.val() != '') { var teststartdate = new date(startdatetextbox.val()); var testenddate = new date(datetext); if (teststartdate > testenddate) startdatetextbox.val(datetext); } else { startdatetextbox.val(datetext); } }, onselect: function(datetext){ var time = new date($(this).datetimepicker('gettime').gettime()); $('#from').timepicker('option', 'maxtime',time); } });
all code put timepicker value on each other input if it's empty.
i need :
from:
to:
and when 16 choosen in #from minutes above 25 disabled,then when 12 choosen in #to minutes below 35 disabled.
can done? if can, how?
please read jquery
doc available there.
here available time picker may helpful
http://jonthornton.github.io/jquery-timepicker
http://jonthornton.github.io/datepair.js https://github.com/wvega/timepicker/tree/master/test/resources/jquery-ui
Comments
Post a Comment