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

Inconsistent creating of eztime fromTimestamp

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 2.0.0
    • 1.7.5
    • Field types
    • None

    Description

      eZ\Publish\Core\FieldType\Time\Value::fromTimestamp uses setTimestamp while eZ\Publish\Core\FieldType\DateAndTime\Value::fromTimestamp uses new \DateTime("@{$timestamp}") which results in an inconsistent handling of these Field Types.

      Consider the following PHP example:

      $dateTime1 = new \DateTime("@3600");
      
      $dateTime2 = new \DateTime;
      $dateTime2->setTimestamp(3600);
      
      var_dump($dateTime1->format('H:i:s'), $dateTime2->format('H:i:s'));
      

      DateTime modified by setTimestamp takes into the account server timezone, while the one created with "@" format does not.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrew.longosz@ibexa.co Andrew Longosz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2 hours
                2h
                Remaining:
                Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified