Opened 6 years ago

Closed 6 years ago

#15126 closed bug (notabug)

Month and year in datepickers dropdown are not refreshing on MM-yy format

Reported by: VishmayShah Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:

Description

In date picker if your textbox type is month and year only, You select a date like April 2018 and focus out of textbox again focus back in textbox and open datepicker and you will find that it started with first value in change year and month dropdowns

let me know if further inputs are required

   $(function () {
        $('.date-picker').datepicker({
            changeMonth: true,
            changeYear: true,
            showButtonPanel: true,
            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();
                $(this).datepicker('setDate', new Date(year, month, 1));
            }
        });
    });

Change History (1)

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

Component: ui.coreui.datepicker
Resolution: notabug
Status: newclosed

That's not a valid date format. The datepicker picks dates, not months.

Note: See TracTickets for help on using tickets.