title: select date from datepicker after i want next year date in next field
body: <p>from date selected by the datepicker in dd-mm--yy format after this i need next year date with -1 day..i.e From:29-07-2016 then To:28-07-2016 like this...please guyz help me..i m sharing my source code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#oldDate').on('change', function(e){
    var oldDate = new Date(this.value);    
    $('.datepicker').datepicker({dateFormat:'dd-mm-yy'});
    
    
    
    $('#old').html(new Date(oldDate));
    oldDate.setDate(oldDate.getDate()-1);
    oldDate.setFullYear(oldDate.getFullYear()+1);
  
   var day = ("0" + oldDate.getDate()).slice(-2);
          var month = ("0" + (oldDate.getMonth() + 1)).slice(-2);
  
          var today = oldDate.getFullYear()+"-"+(month)+"-"+(day);
          
  //        var today = oldDate.(day)+"-"+(month)+"-"+getFullYear();
  //        alert(today);
          $('#new').val(today);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p class="left"&gt;
              &lt;label for="from"&gt;FROM:&lt;/label&gt;
              &lt;input type="text" name="from" id="oldDate"  class="datepicker"/&gt;
            &lt;/p&gt;
            &lt;p class="pull-right"&gt;
              &lt;label for="to"&gt;TO:&lt;/label&gt;
              &lt;input type="text" name="to" id="new"&gt;
            &lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>