title: (getDate() - 1) function is getting the value zero if the current date is 1
body: <p><strong>My Requirement:</strong></p>
  
  <p>I'm having to fields Start Date and End Date, If the End Date is left empty while saving the record, the End Date Field value is populated with plus 1 year based on the entered from date. </p>
  
  <p><strong>My Issue:</strong></p>
  
  <p>If the <strong>Start Date is "9/1/2016"</strong> and the End Date is Left Empty means it should <strong>automatically populate the End Date value as "8/31/2016"</strong> but it <strong>returning the End Date value as "9/0/2016"</strong> and also i'm getting the following <strong>ERROR MESSAGE</strong></p>
  
  <p><strong>Error: JS_EXCEPTION
  INVALID_FLD_VALUE You have entered an Invalid Field Value Invalid Date for the following field: custrecord_end_date</strong></p>
  
  <p><strong>CODE:</strong>
  SCRIPT : <strong>CLIENT SCRIPT, EVENT :SaveRecord</strong></p>
  
  <pre><code>function saveRecord(scriptContext) {
    var newRecord= scriptContext.currentRecord;
   var fromDate = new Date(newRecord.getValue('custrecord_created_date'));
   var endDate = newRecord.getValue('custrecord_end_date');
     if (endDate == null || endDate == '') {
      //getting plus 1 year based on the From Date
      tempEndDate = addingPlusYearOfTheCurrentDate(fromDate);
  
     //setting the value to the End Date Field
       newRecord.setValue('custrecord_end_date', tempEndDate);
  
  }
  }
    // Add Plus Year from the Start Date when the End Date is Empty
          function addingPlusYearOfTheCurrentDate(fromDate ) {
              var date = new Date();
              var Month = (fromDate.getMonth() + 1);
              var Dates = (fromDate.getDate() - 1);
              var Year = (fromDate.getFullYear() + 1);
              var last_Day = new Date(Month + '/' + Dates + '/' + Year);
  
  
              log.debug('last_Day:', last_Day);
              return last_Day;
          }
  </code></pre>