title: get last week in javascript
body: <p>I am using the following in a script:</p>
  
  <pre><code>var startDate = new Date("10/12/2012");
  var endDate = new Date("10/18/2012");
  </code></pre>
  
  <p>I would like those dates to be dynamically created with startDate as last Monday and endDate as last Sunday. I have tried the following:</p>
  
  <pre><code>var curr = new Date; // get current date
  var first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week
  var last = first + 6; // last day is the first day + 6
  var startDate = new Date(curr.setDate(first)).format("m/dd/yyyy");
  var endDate = new Date(curr.setDate(last)).format("m/dd/yyyy");
  </code></pre>
  
  <p>But for some reason this doesn't work - nothing is outputted for the startDate or endDate variables.</p>
  
  <p>Any ideas what I am doing wrong?</p>