Skip to main content

Search and Top Navigation

#7994 closed bug (notabug)

Opened January 06, 2012 08:03PM UTC

Closed January 06, 2012 08:07PM UTC

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);

}

});

Attachments (0)
Change History (1)

Changed January 06, 2012 08:07PM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

This is a date picker, not a month picker.