title: Uncaught TypeError: undefined is not a function
body: <p>I am trying to find the difference between 2 dates in whole months, I found a little script on Stack Exchange, but it keeps giving me an error of "Uncaught TypeError: undefined is not a function".</p>
  
  <p>I get this in chrome, it is a fairly simple HTML page.</p>
  
  <p>It doesn't seem to like the first line of the function (var monthsLeft = to.getMonth() etc...)</p>
  
  <p>(slightly simplified version for clarity:)</p>
  
  <pre><code>&lt;script&gt;
  function monthDiff(from, to) {
      var monthsLeft = to.getMonth() - from.getMonth() + (12 * (to.getFullYear() - from.getFullYear()));
      if(to.getDate() &lt; from.getDate()) {
          monthsLeft--;
      }
      return monthsLeft;
    }
  
  
  function lumpChange() {
  
          var today = new Date();
          var april5th = new Date();
          var MonthsLeft = 0;
  
          today = '10/05/2015';
          april5th = '04/05/2015';
          MonthsLeft = monthDiff(today, april5th);  
    }
  
  &lt;/script&gt;
  </code></pre>