title: Validating Month/Year to be greater then current date
body: <p>I'm trying to add validation the type = "month" field on my form so that if the date entered is not greater then-current date it will give an alert.</p>
  
  <p>So far iv managed to link function to my submit button using <code>onlcick</code>, iv got a variable that gets the current date and stores it in another variable, and iv attempted to write if/else statements but I believe the logic is incorrect.</p>
  
  <p>I'll only show the code that applies to my question, if more code is required I can provide.</p>
  
  <p>My form:</p>
  
  <pre class="lang-php prettyprint-override"><code>    &lt;div id="container"&gt;
      &lt;form method="post" action="www.someplace.php" id="MovieForm"&gt;
           &lt;div id="col-50"&gt;
              &lt;label for="expmonth"&gt;Expiry Date&lt;/label&gt;
              &lt;input type="month" id="expmonth" name="expmonth"&gt;
                     &lt;/div&gt;
  &lt;div id="col-50"&gt;
          &lt;button type="submit"  onclick="return ValidateForm();"  id="btn"&gt;&lt;Strong&gt;Proceed to checkout&lt;/Strong&gt; &lt;/button&gt;
            &lt;/div&gt;
        &lt;/form&gt;
  </code></pre>
  
  <p>My JS Function:</p>
  
  <pre><code>&lt;script&gt;
  function ValidateForm() {
    var expValidate = document.getElementById("expmonth").value;
    var today = new Date();
    var date = today.getFullYear()+'-'+(today.getMonth()+1)
    var isValid = false;
  
      if (expValidate &gt; today) {
          isValid = true;
          alert("correct month") 
      }
      else {
          alert("Wrong month")
          return false;
      }
  }
  </code></pre>
  
  <p>So if I was to run that code and enter a date above the current one it would give me an alert saying "The wrong month" then return me to the form (even though it should be saying "Correct Month" then sending me to the next page).</p>
  
  <p>But the same thing also happens if I was to run the code and enter a month below the current date, it still gives the message "The wrong month" then return me to the form.</p>