I'm trying to change date format as the year is changed. The default format is "dd M" but when a date not in the current year is selected then I want to add the year. This all works well adding year to the format. It's when changing back I run into trouble.
$("#id").datepicker({
...
onSelect: function(dateText, inst){
if (currentYear == currentDate.getFullYear()) {
$("#id").datepicker("option", "dateFormat", "dd M");
} else {
$("#id").datepicker("option", "dateFormat", "dd M yy");
}
});
It seems as though the datepicker really doesn't like going from having the year included in the format to removing it.
Anyone got any suggestions?