xdan/datetimepicker — pull request #65 by danielksb (2014-02-26 19:52:02+00:00)
Title: Fixed incorrect date when selecting previously month

This commit is fixing a bug which occured during date selection. When selecting a day of the previous month which is higher than the current date's day the wrong date will be selected. This happens because setting a day with setDate() which is higher than the current month will automatically change the day to a lower number. That's why the month has to be set before the day.

How to reproduce: Let's say February, 26th is selected and then the user wants to switch to January, 30th then January, 2nd will be selected instead.