Opened 8 years ago

Closed 8 years ago

#7994 closed bug (notabug)

dateFormat: 'MM yy' causes getDate to return todays date.

Reported by: drenner Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.datepicker Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:

Description

When using the date format of the following, 'MM yy'. If I were to set the date using the setDate method and then call getDate, the current date is returned and not the date that was set. I am currently testing in Chrome.

Below is a code sample, you can place an alert to print out the variable setDate and it will print out with the date the was set but if you make a call to 'getDate' that value that you set is not returned. Other dateFormats work however.

$('#monthSelection').datepicker({

changeMonth: true,
changeYear: true,
showButtonPanel: true,
showAnim: 'fold',
dateFormat: 'MM yy',
onClose: function(dateText, inst) {

var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
var setDate = new Date(year, month, 1);
$(this).datepicker('setDate', setDate);

}

});

Change History (1)

comment:1 Changed 8 years ago by Scott González

Resolution: invalid
Status: newclosed

This is a date picker, not a month picker.

Note: See TracTickets for help on using tickets.