Opened 11 years ago
Closed 10 years ago
#7658 closed bug (worksforme)
yearRange erroneous behaviour
Reported by: | mollykrakker | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.11.0 |
Component: | ui.datepicker | Version: | 1.8.15 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
With below settings, the datepicker works as expected, but when I change the yearRange to '1930:c-7' it makes very weird things with the year select.
$( "#dt_birthday" ).datepicker({
showMonthAfterYear: true, changeMonth: true, changeYear: true, yearRange: '1930:-7'
});
Change History (4)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
The problem lies in the _generateMonthYearHeader::determineYear function. When a c-N format used, the year calculated uses the drawYear variable, instead of using thisYear.
Old: var year = (value.match(/c[+-].*/) ? *drawYear* + parseInt(value.substring(1), 10) : (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : parseInt(value, 10)));
Correct: var year = (value.match(/c[+-].*/) ? thisYear + parseInt(value.substring(1), 10) : (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : parseInt(value, 10)));
comment:3 Changed 10 years ago by
Milestone: | 1.9.0 → 1.11.0 |
---|
comment:4 Changed 10 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
This works as expected: http://jsfiddle.net/v8Ry6/1/ "c" menas the currently selected year. Please feel free to reopen this bug and provide a test case if you feel it was closed in error.
http://jsbin.com/ifelit