Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
if(StartingDate.value.length > 0) {   
  var md = StartingDate.value.split('-');
  var today=new Date();  
  var hour = today.getHours();  
  var oldDate = new Date(md[0],md[1]-1,md[2],hour); 
  
  var year = parseInt(oldDate.getFullYear(), 10);  
  var month = parseInt(oldDate.getMonth(), 10);  
  var date = parseInt(oldDate.getDate(), 10);
 
  var newDate = new Date(year + 3, month, date, hour); 
  var m = newDate.getMonth()+1;  
  var d = newDate.getDate();  
  var y = newDate.getFullYear();   
  var newDateStr = m + '-' + d + '-' + y;  
  ExpirationDate.value = newDateStr; 
}

 Change the "3" in this line to the number of years that you want to add - var newDate = new Date(year + 3, month, date, hour);

...