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

Inconsistencies in values displayed by Date Field Type

    Details

      Description

      There are some inconsistencies in values displayed by Date Field Types when using Legacy Bridge, between frontoffice and the backoffice and the legacy stack and the new stack. Or when having data from legacy (migration/upgrade).

      There are also issues in eZ Platform itself here overlapping with this covered in EZP-29136.

      Steps to reproduce

      1. Create new eZ Platform installation with Legacy Bridge. I have date.timezone setting in php.ini set to "Europe/Warsaw" and have the browser's timezone set analogically (this affects the results below, meaning that the displayed values might be different if using different timezones).
      2. In the app/config/ezplatform.yml, add the following configuration:

        ez_publish_legacy:
            system:
                ezdemo_site_clean_group:
                    templating:
                        view_layout: AppBundle::pagelayout.html.twig
        

      3. Create file src/AppBundle/Resources/views/pagelayout.html.twig with the following content:

        <!doctype html>
        <html>
        <body>
            <h1>The legacy generated content</h1>
            <div class="content">
                {% block content %}{% endblock %}
            </div>
            <h1>The new stack generated content (using ez_render_field)</h1>
            <div class="content">
                {{ ez_render_field(
                    content,
                    'date'
                ) }}
                {{ ez_render_field(
                    content,
                    'date_and_time'
                ) }}
            </div>
        </body>
        </html>
        

      4. Create a Content Type with a Date and DateAndTime Field Definitions. Put 'date' and 'date_and_time' as their identifiers, respectively.
      5. In the Legacy backoffice, create a Content Object of this Content Type, giving it a date value in one field (for example "01/06/2018") and date and time value in other field (for example "01/06/2018 12:00 pm").
      6. Check the values displayed for this Content Object:
        • In the Legacy backoffice, navigate to this Content Object. You should see its fields values displayed correctly:

          Date:
          01/06/2018
          Date and time:
          01/06/2018 12:00 pm
          

        • In the Platform UI, navigate to this Content Object. You should see the following values (note the wrong value for Date Field Type):

          Date
          31 May 2018
          Date and time
          1 June 2018, 12:00
          

        • In the frontoffice, navigate to this Content Object. If you display it using Legacy stack ("The legacy generated content"), you will see the following values (correct):

          01/06/2018
          01/06/2018 12:00 pm
          

        • If you display the same Content Object using ez_render_field ("The new stack generated content"), you will see the following values (note the wrong value for Date Field Type):

          31/05/2018
          01/06/2018, 12:00
          

      7. Now, after I change date.timezone setting in php.ini set to "America/Puerto_Rico" (without republishing the Content), I have the following results:
        • In the Legacy backoffice values are displayed like the following (the same as before):

          Date:
          01/06/2018
          Date and time:
          01/06/2018 12:00 pm
          

        • In the Platform UI nothing changes (value for Date Field Type is still wrong):

          Date
          31 May 2018
          Date and time
          1 June 2018, 12:00
          

        • In the frontoffice, using the Legacy stack, the values are the following (also the same as before):

          01/06/2018
          01/06/2018 12:00 pm
          

        • In the frontoffice, using the new stack, both values are different (the Date Field Type by 2 days, while Date and time by 6 hours):

          30/05/2018
          01/06/2018, 06:00
          

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Confirmed Confirmed
          1m 39s 1 jacek.foremski@ez.no 04/Jun/18 11:40 AM
          Confirmed Confirmed InputQ InputQ
          6s 1 jacek.foremski@ez.no 04/Jun/18 11:40 AM
          InputQ InputQ Development Development
          197d 2h 39m 1 mateusz.biniek@ez.no 18/Dec/18 1:20 PM
          Development Development Development Review Development Review
          29s 1 mateusz.biniek@ez.no 18/Dec/18 1:20 PM
          Development Review Development Review Documentation Review done Documentation Review done
          23d 1h 33m 1 André Rømcke 10/Jan/19 2:53 PM

            People

            • Assignee:
              Unassigned
              Reporter:
              Jacek Foremski (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated: