Skip to main content

Search and Top Navigation

#7658 closed bug (worksforme)

Opened August 20, 2011 06:40PM UTC

Closed October 19, 2012 07:16PM UTC

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'

});

Attachments (0)
Change History (4)

Changed August 20, 2011 06:41PM UTC by mollykrakker comment:1

Changed August 20, 2011 06:56PM UTC by mollykrakker comment:2

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)));

Changed October 11, 2012 02:43PM UTC by scottgonzalez comment:3

milestone: 1.9.01.11.0

Changed October 19, 2012 07:16PM UTC by mikesherov comment:4

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.