Changeset 1210

Show
Ignore:
Timestamp:
11/02/06 01:19:52 (2 years ago)
Author:
dominik
Message:

add the start year of the final rule to the timezone data refs #62

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/config/AgaviTimeZoneDataParser.class.php

    r1209 r1210  
    325325            $myRules[] = array('time' => $lastRuleEndTime, 'rawOffset' => $gmtOff, 'dstOffset' => $dstOff, 'name' => $format); 
    326326          } else { 
    327             // TODO: !! 
     327            // TODO: we probably don't need to add the first rule at all, check this! 
    328328          } 
    329329 
     
    332332 
    333333        if($lastZoneRule) { 
     334          if(count($myRules) == 0) { 
     335            // this should actually never happen! 
     336            $lastRuleStartYear = self::MIN_YEAR_VALUE; 
     337          } else { 
     338            $cal = $this->getContext()->getTranslationManager()->createCalendar(); 
     339            $cal->setTime($myRules[count($myRules) - 1]['time'] * AgaviDateDefinitions::MILLIS_PER_SECOND); 
     340            // + 1 because this specifies the first year in which the final rule will apply 
     341            $lastRuleStartYear = $cal->get(AgaviDateDefinitions::YEAR) + 1; 
     342          } 
     343 
    334344          if($activeSubRules !== null) { 
    335345            $cnt = count($activeSubRules); 
     
    338348            } 
    339349            if($cnt == 0) { 
    340               $finalRule = array('type' => 'none', 'offset' => $gmtOff); 
     350              $finalRule = array('type' => 'none', 'offset' => $gmtOff, 'startYear' => $lastRuleStartYear); 
    341351            } else { 
    342352              // normalize the keys 
     
    369379                  'type' => AgaviSimpleTimeZone::WALL_TIME, 
    370380                ), 
     381                'startYear' => $lastRuleStartYear,  
    371382              ); 
    372383 
     
    401412            } 
    402413          } else { 
    403             $finalRule = array('type' => 'static', 'name' => $format, 'offset' => $gmtOff); 
     414            $finalRule = array('type' => 'static', 'name' => $format, 'offset' => $gmtOff, 'startYear' => $lastRuleStartYear); 
    404415          } 
    405416        }