Forráskód Böngészése

[ZF-7858] Zend_Date:

- changed timezone format for historical dates
(note that historical dates do not contain a timezone as timezones are available since 1914)


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18433 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 16 éve
szülő
commit
9b8a6c7373

+ 1 - 0
library/Zend/Date/DateObject.php

@@ -565,6 +565,7 @@ abstract class Zend_Date_DateObject {
                 case 'c':  // ISO 8601 date format
                     $difference = $this->getGmtOffset();
                     $difference = sprintf('%s%04d', ($difference <= 0) ? '+' : '-', abs($difference) / 36);
+                    $difference = substr($difference, 0, 3) . ':' . substr($difference, 3);
                     $output .= $date['year'] . '-'
                              . (($date['mon']     < 10) ? '0' . $date['mon']     : $date['mon'])     . '-'
                              . (($date['mday']    < 10) ? '0' . $date['mday']    : $date['mday'])    . 'T'

+ 1 - 1
tests/Zend/Date/DateObjectTest.php

@@ -434,7 +434,7 @@ class Zend_Date_DateObjectTest extends PHPUnit_Framework_TestCase
         $this->assertSame(      '+01:00', $date->date('P',-7000000000));
         $this->assertSame(         'CET', $date->date('T',-7000000000));
         $this->assertSame(        '3600', $date->date('Z',-7000000000));
-        $this->assertSame(       '1748-03-06T12:33:20+0100', $date->date('c',-7000000000));
+        $this->assertSame('1748-03-06T12:33:20+01:00', $date->date('c',-7000000000));
         $this->assertSame('Wed, 06 Mar 1748 12:33:20 +0100', $date->date('r',-7000000000));
         $this->assertSame( '-7000000000', $date->date('U'    ,-7000000000 ));
         $this->assertSame(           'H', $date->date('\\H'  ,-7000000000 ));