lucianocosta/jquery.mtz.monthpicker — pull request #57 by macblazer (2014-03-01 19:40:25+00:00)
Title: Added setDate method.  Fixed parseInt calls to use radix 10.

I fixed the two parseInt calls to explicitly specify base 10. This fixes a problem if the data-month attribute of the input element is set to "09".

I added a setDate method that takes a one-based integer month and year to be used on pages that reset the selected month/year. Ajax pages that get new data from the server need to be able to easily update the month picker that's already on the page.

The setValue method can also be used to set the selected month/year, but that has a few drawbacks:

1. You have to keep the complete settings object outside of the month picker instead of just passing the settings at page creation.

2. You have to set the selectedMonthName if you're using the 'mmm' format. If the month picker is localized, requiring the selected month name is then dependent on tracking what localization you're in and the localized month names which defeats otherwise simple localization efforts.

3. The setValue method calls this.change() which will trigger other JS that is watching for the user to change the month picker. This is usually undesired behavior if you're programmatically pushing a new month/year into the month picker.