Opened 8 years ago

Closed 7 years ago

#7631 closed bug (duplicate)

datepicker does not honor yearRange

Reported by: gor Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.datepicker Version: 1.8.15
Keywords: Cc:
Blocked by: Blocking:

Description

The datepicker with specified yearRange misbehaves.

  1. Specify yearRange 1900-2012
  2. Open datepicker
  3. Click next month button, until year becames 1900 (after overflow)
  4. Choose any date in 1900 year
  5. Selected date is in 2013 year

Here is a unit test, than could be added to test suite:

(function($) {
    module("datepicker: gor");
    test('gor-test', function() {
        var inp = init('#inp', {yearRange: '1900:2010', changeYear: true});
        var dp = $('#ui-datepicker-div');

            inp.val('01/01/2010').datepicker('show');

        var next = $('a.ui-datepicker-next', dp);

        //press next button 12 times.
        //this should change year to 1900
        for (var i = 0; i <12; i++){
            next.click();
        }
        $('.ui-datepicker-calendar a:contains(10)').click()
        equals($('select.ui-datepicker-year', dp).val(), "1900");

        inp.datepicker('hide');
        var date = inp.datepicker('getDate');
        equal(date.getFullYear(), 1900);
    });
})(jQuery);

Change History (2)

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

Milestone: 1.9.01.11.0

comment:2 Changed 7 years ago by mikesherov

Resolution: duplicate
Status: newclosed

Duplicate of #7362.

Note: See TracTickets for help on using tickets.