title: Postman Pre-req Function for Date Assign
body: <p>I am trying to write a function to format and assign a past or future date on some date fields in my request. However, I got an error says assignedDate is not a function. </p>
  
  <pre><code>function changeDate(numberOfDays) {
  var assignedDate = new Date().toISOString();
  assignedDate.setDate(assignedDate.getDate() - numberOfDays);
  assignedDate.substr(0, assignedDate.length-5);
  return assignedDate; } 
  </code></pre>
  
  <p>Then I change it as I did at first place;</p>
  
  <pre><code>function changeDate(numberOfDays) {
  var assignedDate = new Date().toISOString();
  var assignedDate.setDate(assignedDate.getDate() - numberOfDays);
  var assignedDate.substr(0, assignedDate.length-5);
  return assignedDate; } 
  </code></pre>
  
  <p>Then it starts to show warning which says "assignedDate is already defined".</p>
  
  <p>I am also a kind of newbie, please let me know your solutions.</p>
  
  <p>Thanks.</p>