Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-18453

template operator // datetime // RFC 5322 (2822, 822) formated date // %r not supported

    XMLWordPrintable

Details

    Description

      http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-operators/Formatting-and-internationalization/datetime

      The documentation states:

      "... The following table reveals the different elements that can be used in a custom format. ..."
      "%R Thu, 21 Dec 2000 16:01:07 +0200 RFC 2822 formated date"

      that is not correct.

      @see lib/ezlocale/classes/ezlocale.php

      [...]
      The following characters are not recognized in the format string:

      • r - RFC 822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" (added in PHP 4.0.4)

      [...]

      The "%r" would be very useful e.g. when creating RSS

          <lastBuildDate>{currentdate()|datetime('custom', '%r')}</lastBuildDate>
      

      simply adding the "r" to "DateTimePHPArray" worked for me to fix this problem ...

      --- a/lib/ezlocale/classes/ezlocale.php
      +++ b/lib/ezlocale/classes/ezlocale.php
      @@ -139,7 +139,7 @@ class eZLocale
               $this->TimePHPArray = array( 'g', 'G', 'h', 'H', 'i', 's', 'U', 'I', 'L', 't' );
               $this->DatePHPArray = array( 'd', 'j', 'm', 'n', 'O', 'T', 'U', 'w', 'W', 'Y', 'y', 'z', 'Z', 'I', 'L', 't' );
               $this->DateTimePHPArray = array( 'd', 'j', 'm', 'n', 'O', 'T', 'U', 'w', 'W', 'Y', 'y', 'z', 'Z',
      -                                         'g', 'G', 'h', 'H', 'i', 's', 'U', 'I', 'L', 't', 'a' );
      +                                         'g', 'G', 'h', 'H', 'i', 's', 'U', 'I', 'L', 't', 'a', 'r' );
               $this->TimeArray = preg_replace( '/.+/', '%$0', $this->TimePHPArray );
               $this->DateArray = preg_replace( '/.+/', '%$0', $this->DatePHPArray );
               $this->DateTimeArray = preg_replace( '/.+/', '%$0', $this->DateTimePHPArray );
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            62d8defb-6e31-4ecf-a57d-547d70171da4@accounts.ibexa.co Stefan Eickhoff
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: