datepicker - how to display date difference using javascript and disable old dates -


i have problem js

i have find difference between 2 days , have disable past dates too..

i tried many scripts have these functions separately.. past disabling alone.. or date calculation.. need both functions combined in work.

i tried out js

you can check out js below link

    [http://jsfiddle.net/w5eta8rm/2/][1] 

kindly check link above.. combined them both.. unable make work..

i dont need alert function.. need show text below datepicker.

thanks in advance.

you can check here in jsfiddle

  • giving days difference , printing in div down datepicker
  • combined past disabling alone , date calculation
  • dateto gets enabled when select datefrom

html file

<form method="post">     <div height="100px">     <br/>     from: <input type="text" name="date_from" id="txtfromdate" autocomplete="off" />     to: <input type="text" name="date_to" id="txttodate" autocomplete="off" />     </div>     <div style="margin-top: 200px;" id="id_days"></div> </form> 

js file

$(document).ready(function(){      $("#txtfromdate").datepicker({          mindate: 0,         maxdate:"+60d",         numberofmonths: 1,         onselect: function(selected,evnt) {             var newdate=new date($('#txtfromdate').val());             $("#txttodate").datepicker("destroy");             $("#txttodate").datepicker({                 mindate: newdate,                 maxdate: "+60d",                 numberofmonths: 1,                 onselect: function(selected,evnt) {                     var maxdate=new date($('#txttodate').val());                     var mindate=new date($('#txtfromdate').val());                     var difference_ms=maxdate-mindate;                     var days = math.floor(difference_ms/(1000*60*60*24));                     $('#id_days').empty();                     $('#id_days').append("diff date is: " + days).show();                 }             });         }     }) }); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -