title: Javascript: wrong date calculation
body: <p>So I just have posted a question about this code (which was answered):</p>
  
  <pre><code>$(document).ready(Main); 
  
  function Main() { 
      ConfigDate();         
  } 
  
  
  function ConfigDate() { 
      var currentTime = new Date(); 
      var dayofWeek = currentTime.getDay(); 
  
      var daysSinceThursday = (dayofWeek + 3) % 7 
      var lastThursday = new Date(currentTime.getDate() - daysSinceThursday); 
      var dd = lastThursday.getDate(); 
  
      var mm = lastThursday.getMonth() + 1; 
      var yyyy = lastThursday.getFullYear(); 
  
      $("#last_thursday").text(yyyy + " / " + mm + " / " + dd); 
  } 
  </code></pre>
  
  <p>The problem now is that the date that appears in my cell is 1969 / 12 / 31 (which isn't even a thursday). </p>
  
  <p>Did I do something wrong while calculating last thursday date?</p>