title: Get the first day name (Mon, Tues...) of the month
body: <p>As the title says I'm trying to get the first day name that a given month starts on.  So for example if Oct 2014 was given the code would return 3 because there are 3 empty blocks before Wed the 1st. Again if I provided Jan 2015, I should get 4. Here is my function:</p>
  
  <pre><code>function getDayMonthStartsOn(month, year) {
      var day = new Date(year + "-" + month + "-01").getDay();
      day = (day === 0) ? 7 : day;
      return day;
  }
  </code></pre>
  
  <p>My problem is that it seems to work for Jan 2015 but not Oct 2014.</p>