title: Last week start date and end date using javascript not giving required result
body: <p>I am using the following code, but it is returning last week's</p>
  
  <p><strong>start date = 0-4/09/2018</strong> and</p>
  
  <p><strong>end date = 02/09/2018</strong>      </p>
  
  <pre><code>var curr = new Date;
  var first = curr.getDate() - curr.getDay(); 
  var last = first + 6; 
  var startDate = new Date(curr.setDate(first));
  var dd1 = startDate.getDate()-6;
  var mm1 = startDate.getMonth() + 1;
  if(dd1&lt;10){
       dd1='0'+dd1
  } 
  if(mm1&lt;10){
       mm1='0'+mm1
  }
  startDate = "" + dd1 + "/" + mm1 + "/" + startDate.getFullYear();
  var endDate = new Date(curr.setDate(last));
  var dd2 = endDate.getDate()-6;
  var mm2 = endDate.getMonth() + 1;
  if(dd2&lt;10){
      dd2='0'+dd2
  } 
  if(mm2&lt;10){
      mm2='0'+mm2
   }
  endDate = "" + dd2 + "/" + mm2 + "/" + endDate.getFullYear();
  </code></pre>