title: See if date selected is future from today - JavaScript
body: <p>I have to compare the date that they want to put in and the current date today, and if they have put in a date that is in the future, then alert them to change the date, otherwise insert the data.</p>
  
  <p>Basically I am having issues comparing the dates. here is my code:</p>
  
  <pre><code>var today = year + '-' + month + '-' + day + ' 00:00:00';
  
  var d1 = new Date(postdate); // postdate = 2014/02/01 ie: 1 Feb 2014
  var d2 = new Date(today); // todays date
  if(d1&gt;d2){
      alert('You cannot post in the future!');
  }
  </code></pre>
  
  <p>But that doesnt seem to work. Where am I going wrong?</p>