View Full Version : Datepickerfield year range incorrect after selecting a date

22 Apr 2012, 9:04 PM

I recently came across a case where the date range was incorrect on the datepickerfield.

When I create the datepickerfield I set the current date as the value and also specify the picker to have a year range (yearFrom and yearTo).

After clicking on the datepicker, then pressing cancel/done - if I view the datepicker again the year range starts at 1980 to the current year.

Here is a snippet of the usage

xtype: 'datepickerfield',
destroyPickerOnHide: true,
name : 'checkInDate',
label: 'Check in',
dateFormat: "d/m/Y",
value: dateOnly(new Date()),
clearIcon: true,
picker: {
yearFrom: parseInt(getCurrentYear()),
yearTo: parseInt(getMaxYear())

//-------- helper methods ----------------------
function getCurrentYear() {
return new Date().getFullYear();

function getMaxYear() {
return new Date().getFullYear() + 5;

Is there a fix or workaround for this?
The aim is to prevent users from selecting dates in the past.


22 Apr 2012, 9:41 PM
Sorry posted in the wrong forum - this is for sencha touch 2.
The following url is the reposted question - http://www.sencha.com/forum/showthread.php?197721-Datepickerfield-year-range-incorrect-after-selecting-a-date&p=786056#post786056