views:

54

answers:

2

what does navigationAsDateFormat do?

also, I have changeMonth and changeYear enabled, how can I make it so that when you change the month and year using those dropdowns, the input field is automatically updated (e.g., updates without having to click on a new day)

A: 

Here's the docs for navigationAsDateFormat

When true the formatDate function is applied to the prevText, nextText, and currentText values before display, allowing them to display the target month names for example.

You could write a function to change the value in the input when the onChangeMonthYear event is raised

Here's a Working Demo

Something like

$('#picker').datepicker({

  onChangeMonthYear: function(year, month, inst) { 
    var now = new Date(this.value);
    if (now) {
        var max = new Date(year, month, 0).getDate();
        var day = now.getDate() > max? 
                    max : now.getDate();       
        var newDate = new Date(year, month -1, day);
        inst.input.datepicker('setDate', newDate); 
    }    
  },
  changeMonth: true,
  changeYear: true
});
Russ Cam
A: 

added this parameter, does what I need it to, but would still like to get the day in the easiest way possible:

onChangeMonthYear: function(year, month, inst) { $(this).val(month + '/01/' + year); }
DavidOSomething