title: Javascript Date() returns wrong weekday for certain dates
body: <p>After getting that issue with the wrong weekday for dates from Sep 1, 2017 and later, I found that changing the sequence of 1 statemtent (setDate) returns correct results. See code below. When I enter 1.9.17 (which is Sep 1, 2017) I get Sunday, with the changed code it's Friday. Can somebody explain that to me? Issue occurs in FF, Chrome and Edge.</p>
  
  <pre><code>&lt;body&gt;
  &lt;input type="text" onchange="wday(this.value);"&gt;
  &lt;script&gt;
  function wday() {
    var x = wday.arguments[0].split(".");
    if (x[2].length&lt;4) x[2] += 2000;
    var y = new Date();
    y.setFullYear(x[2]);
    y.setMonth(x[1]-1);
    y.setDate(x[0]);
    var z = new Array("So","Mo","Di","Mi","Do","Fr","Sa");
    alert("wrong "+z[y.getDay()])
    wday2(wday.arguments)
    }
  function wday2() {
    var x = wday.arguments[0].split(".");
    if (x[2].length&lt;4) x[2] += 2000;
    var y = new Date();
    y.setDate(x[0]);
    y.setMonth(x[1]-1);
    y.setFullYear(x[2]);
    var z = new Array("So","Mo","Di","Mi","Do","Fr","Sa");
    alert("correct "+z[y.getDay()])
    }
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>