Fix issue with datepicker not correctly showing selected date if it was in a different month that the current month. Closes #1794.