Search and Top Navigation
#7631 closed bug (duplicate)
Opened August 11, 2011 02:28PM UTC
Closed October 19, 2012 07:07PM UTC
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);