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

Viewing an object with time set to "00:00" always present it as "this field is empty"

    Details

      Description

      Steps to reproduce
      • Create content type with a time fieldtype
      • Create an object of previous content type
      • On the time field set it to "00:00"
      • Publish it

      When viewing the created object, the time has a "This field is empty" message instead of "00:00"

        Issue Links

          Activity

          Hide
          Gunnstein Lye added a comment -

          The same will happen with DateAndTime, possibly also Date, if you set it to 1970-01-01 00:00. These store time as seconds. The solution should be to differ between `null` and zero here.

          Show
          Gunnstein Lye added a comment - The same will happen with DateAndTime, possibly also Date, if you set it to 1970-01-01 00:00. These store time as seconds. The solution should be to differ between `null` and zero here.
          Hide
          St├ęphane Diot added a comment - - edited

          Ok the problem here comes from the REST API, after testing the steps to reproduce the bug, here is the field that I have in the Version Update Struct for a time field set to "00:00":

          "field":[{
              "id":731,
              "fieldDefinitionIdentifier":
              "new_eztime_1",
              "languageCode":"eng-GB",
              "fieldValue":0
          }]
          

          We can see that the fieldValue is correctly set to 0 (the time is transformed to a number of milliseconds).

          Then when the Content item is fetched from the REST API, the same field is available in the Content returned by the REST API as:

           "field": [{
              "id": 731,
              "fieldDefinitionIdentifier": "new_eztime_1",
              "languageCode": "eng-GB",
              "fieldValue": null
          }],
          

          The fieldValue is now null, so it seems 0 is transform to null somewhere server side.

          Show
          St├ęphane Diot added a comment - - edited Ok the problem here comes from the REST API, after testing the steps to reproduce the bug, here is the field that I have in the Version Update Struct for a time field set to "00:00": "field":[{ "id":731, "fieldDefinitionIdentifier": "new_eztime_1", "languageCode":"eng-GB", "fieldValue":0 }] We can see that the fieldValue is correctly set to 0 (the time is transformed to a number of milliseconds). Then when the Content item is fetched from the REST API, the same field is available in the Content returned by the REST API as: "field": [{ "id": 731, "fieldDefinitionIdentifier": "new_eztime_1", "languageCode": "eng-GB", "fieldValue": null }], The fieldValue is now null, so it seems 0 is transform to null somewhere server side.
          Hide
          Bertrand Dunogier added a comment -

          FYI, related to EZP-25375, but not fixed by the PR from [~yannick.roger@ez.no].

          Show
          Bertrand Dunogier added a comment - FYI, related to EZP-25375 , but not fixed by the PR from [~yannick.roger@ez.no] .
          Hide
          Bertrand Dunogier added a comment -

          After testing, The PR from EZP-25375 makes 00:00 usable as an input value, but still stores NULL in the database (needs to be fixed as well).

          If `ezcontentobject_attribute.data_int` is set to 0, the REST API returns the expected value:

          {
            "id": 491,
            "fieldDefinitionIdentifier": "time",
            "languageCode": "eng-GB",
            "fieldValue": 0
          }
          

          But PlatformUI will still show "Empty value", meaning that there is a bug in PlatformUI itself.

          Show
          Bertrand Dunogier added a comment - After testing, The PR from EZP-25375 makes 00:00 usable as an input value, but still stores NULL in the database (needs to be fixed as well). If `ezcontentobject_attribute.data_int` is set to 0, the REST API returns the expected value: { "id": 491, "fieldDefinitionIdentifier": "time", "languageCode": "eng-GB", "fieldValue": 0 } But PlatformUI will still show "Empty value", meaning that there is a bug in PlatformUI itself.
          Hide
          Yannick Roger (Inactive) added a comment -

          This issue will be taking care of in EZP-25375

          Show
          Yannick Roger (Inactive) added a comment - This issue will be taking care of in EZP-25375

            People

            • Assignee:
              Unassigned
              Reporter:
              Paulo Nunes (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: