Opened 8 years ago

Closed 6 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:2 Changed 8 years ago by mollykrakker

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 6 years ago by Scott González

Milestone: 1.9.01.11.0

comment:4 Changed 6 years ago by mikesherov

Resolution: worksforme
Status: newclosed

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.

Note: See TracTickets for help on using tickets.