$('.selector').datepicker({
onChangeMonthYear: function(year, month, inst) { ... }
});
¿Cómo puedo utilizar el parámetro 'inst' de onChangeMonthYear a seleccionar automáticamente el primer día del mes?jQuery UI selector de fechas onChangeMonthYear y el parámetro inst
véase: http://jsfiddle.net/sD8rL/
Actualmente estoy usando el código de abajo, pero me siento como si debiera ser capaz de utilizar la variable 'inst' de una manera más sencilla.
$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
maxDate:0,
onChangeMonthYear: function(year, month, inst){
// set date to 1st on year or month change
// this seems bit janky, but works
$('#' + inst.id).datepicker("setDate", month + '/1/' + year);
// Can't I use the instatnce to set the date?
// $(inst).datepicker("setDate", month + '/1/' + year); // fails
// inst.datepicker("setDate", month + '/1/' + year); // fails
// inst.selectedDay = 1; // fails
// inst.currentDay = 1; // fails
}
});
Tiene todo el sentido que realmente no tenía ninguna razón en particular para usar 'inst', 'esto' funciona muy bien. – ActionOwl