Unable to retrieve minimum date from datetime predicate

Report a Dgraph Bug

Unable to set and retrieve minimum datetime with RFC 3339 and ISO 8601 string of 0001-01-01T00:00:00+00:00.

What version of Dgraph are you using?


Have you tried reproducing the issue with the latest release?


What is the hardware spec (RAM, OS)?

Kubernetes (3xZero, 3xAlpha), Amazon Linux EC2, Ubuntu container

Steps to reproduce the issue (command/config used to run Dgraph).

These were tested with Ratel console.

Step 1 Mutate the data

  "set": [
      "dgraph.type": "REVIEW_CYCLE",
      "uid": "0x67d18e",
      "reviewCycleDueBy": "0001-01-01T00:00:00",
      "reviewCycleAssesmentPeriodStart": "0001-01-01T00:00:00",
      "reviewCycleAssesmentEnd": "0001-01-01T00:00:00"

Step 2 Query the result

query all($reviewCycleId: string = "0x67d18e")
    reviewCycle(func: uid($reviewCycleId)) {
        name: reviewCycleName
        description: reviewCycleDescription
        dueBy: reviewCycleDueBy
        assesmentPeriodStart: reviewCycleAsementPeriodStart
        assesmentPeriodEnd: reviewCycleAssesmentEnd

Expected behaviour and actual result.

Actual Behavior

  "data": {
    "reviewCycle": [
          "name": "Jacobtest4",
          "description": "Jacob test 4 desc",
          "dueBy": "",
          "assesmentPeriodStart": "",
          "assesmentPeriodEnd": "",

Expected Behavior

The expectation was to get the minimum datetime back, but this is not the case, as the results are empty strings.

The data is still there and when the predicate is changed to a type of string, you can see the results. But when the predicate is of type datetime, the result for the same data is returned back as empty strings, i.e. "".

If a second is added to the minimum datetime, i.e. 0001-01-01T00:00:01, the proper results will be returned.

Fixed with https://github.com/dgraph-io/dgraph/pull/7236 . The PR has been merged.

1 Like