title: jQuery datepicker get month and year shown not current
body: <p>I'm trying to get the "shown" month and year after hitting the "next" and "previous" links on the left and right of the date picker header.</p>
  
  <p>Currently I'm using to get the month:</p>
  
  <pre><code>var selectedMonth = $('#calendar').datepicker('getDate').getMonth() + 1;
  </code></pre>
  
  <p>but it only returns the current month, not the shown month that comes with clicking "next" or "prev".</p>
  
  <p>EDIT</p>
  
  <p>I added the <code>onChangeMonthYear</code> option with the datepicker in the function i have</p>
  
  <pre><code>function getDates() {
  var selectedMonth = $('.ui-datepicker-month').text();
  var selectedYear = $('.ui-datepicker-year').text();
  }
  </code></pre>
  
  <p>still this just states the current date.</p>
  
  <p>EDITED Again</p>
  
  <p>the above worked just needed to set a delay :]</p>