             syncSelectedDate = true;
             
             longestDateItem = null;
+            longestYearItem = null;
             
             invalidateProperties();
         }

                curObj = listData[i];
                if (curObj[SpinnerList.ENABLED_PROPERTY_NAME] != newEnabledValue)
                {
                    generateDateItemObject(curObj.label, curObj.data, newEnabledValue);
                    o["accentColor"] = curObj["accentColor"];
                    listData[i] = o;
                }

    
    // identify the dateList item that has the longest width in DATE_AND_TIME mode    
    private function findLongestDateItem():Object
    {
        updateDayMonthDateFormatter();
        
        dateTimeFormatter.dateTimePattern =  dayMonthDateFormatter.getMonthPattern();
        
        var longestDateItemObj:Object = dateList.dataProvider.getItemAt(0);
        var longestMonth:int = 0;
        var labelWidth:Number = -1;
        var maxWidth:int = 0;
        var dateStr:String;
        dateObj.date = 1;
        
        // find the longest month
        for (var month:int = 0; month < 12; month++)
        {
            dateObj.month = month;
            labelWidth = measureText(dateTimeFormatter.format(dateObj)).width;
            if (labelWidth > maxWidth)
            {
                maxWidth = labelWidth;
                longestMonth = month;
            }
        }
        
        dateObj.month = longestMonth;
        maxWidth = 0;
        
        // find the longest dateList item
        for (var date:int = 1; date <= 31; date++)
        {
            dateObj.date = date;
            dateStr = dayMonthDateFormatter.format(dateObj);
            labelWidth = measureText(dateStr).width;
            if (labelWidth > maxWidth)
            {
                maxWidth = labelWidth;
                // TODO: dateObj.time for second argument?
                longestDateItemObj = generateDateItemObject(dateStr, dateObj.time);
            }
        }
        
        return longestDateItemObj;
    }
    
    // TODO: rename variable names and relocate the function.
    // identify the yearList item that has the longest width in DATE mode 
    // the range of year should be from 1601 to 9999
    private function findLongestYearItem():Object
    {
        // TODO: create functions e.g. getLongestDigit(6) returns the longest digit among 6, 7, 8, 9
        var longestDigitIncludingZero:int;
        var longestDigitExcludingZero:int;
        var longestDigitOf6789:int;
        var longestDigitOf789:int;
        
        var maxWidthForlongestDigitIncludingZero:Number = 0;
        var maxWidthForlongestDigitExcludingZero:Number = 0;
        var maxWidthForlongestDigitOf6789:Number = 0;
        var maxWidthForlongestDigitOf789:Number = 0;
        
        var labelWidth:Number;
        
        // instantiate the number formatter and update its locale
        updateNumberFormatter();
        
        // find the four types of the longest digit 
        for (var i:int = 0; i < 10; i++) 
        {
            labelWidth = measureText(numberFormatter.format(i)).width;
            
            if (labelWidth > maxWidthForlongestDigitIncludingZero)
            {
                maxWidthForlongestDigitIncludingZero = labelWidth;
                longestDigitIncludingZero = i;
            }
            
            if (i >= 1 && labelWidth > maxWidthForlongestDigitExcludingZero)
            {
                maxWidthForlongestDigitExcludingZero = labelWidth;
                longestDigitExcludingZero = i;
            }
            
            if (i >= 6 && labelWidth > maxWidthForlongestDigitOf6789)
            {
                maxWidthForlongestDigitOf6789 = labelWidth;
                longestDigitOf6789 = i;
            }
            
            if (i >= 7 && labelWidth > maxWidthForlongestDigitOf789)
            {
                maxWidthForlongestDigitOf789 = labelWidth;
                longestDigitOf789 = i;
            }
        }
        
        // generate the longest width year
        var longestYear:int = longestDigitExcludingZero * 1000;
        
        if (longestDigitExcludingZero > 1)
            longestYear += longestDigitIncludingZero * 111;
        else // longestDigitExcludingZero == 1
            longestYear += ((longestDigitIncludingZero == 0)? longestDigitOf789 : longestDigitOf6789) * 100 +
                longestDigitIncludingZero * 10 + longestDigitIncludingZero;

        dateObj.fullYear = longestYear;
        dateTimeFormatter.dateTimePattern = dateTimeFormatterEx.getYearPattern();
        return generateDateItemObject(dateTimeFormatter.format(dateObj), longestYear);
    }
    
    // instantiate the number formatter and update its locale property
    private function updateNumberFormatter():void
    {
        if(!numberFormatter)
            numberFormatter = new NumberFormatter();
        
        var localeStr:String = getStyle("locale");
        if (localeStr)
            numberFormatter.setStyle("locale", localeStr);
        else
            numberFormatter.clearStyle("locale");
    }
    
    // instantiate the dayMonthDateFormatter and update its locale property
    private function updateDayMonthDateFormatter():void
    {
        if (!dayMonthDateFormatter)
        {
