Equality functions not working for DateTime

When using equality functions where the value is also from a predicate, I get the error:

Got error: parsing time \"UserStatus.createdAt\" as \"2006-01-02T15:04:05\":
 cannot parse \"UserStatus.createdAt\" as \"2006\" while running: name:\"gt\" args:\"UserStatus.createdAt\" ",

The query I’m using:

query {
  g(func: type(UserStatus)) {
    UserStatus.question @filter(gt(Ques.publishedAt, UserStatus.createdAt)) {

and the schema:

type UserStatus {
  id: ID!
  question: Ques!
  createdAt: DateTime!

type Ques {
  id: ID!
  name: String!
  publishedAt: DateTime!

These two questions suggest that the DateTime should be in the RFC3339 format, so I tried that but no luck.
UserStatus.createdAt = "2020-11-05T18:08:05.000000786-07:00"

If I replace User.createdAt with the value itself, it works.
For example:
UserStatus.question @filter(gt(Ques.publishedAt, "2020-11-05T18:08:05Z)) {
And it doesn’t even need to be in RFC format.

Is this a known issue?

What is going on here? I don’t get it. You are using two predicates as params or is that a typo in your question?

Is that wrong? I figured since both preds are of type Datetime, I could just use it like that.

Basically, what I want to do is get a question where Ques.publishedAt > UserStatus.createdAt.

Yes. It is. You should user variables instead.

Something like this(not precise)

  var(func: type(UserStatus)) {
    DT as createdAt
  g(func: type(Ques)) @filter(gt(Ques.publishedAt, val(DT))) {
1 Like

So I had something like that and it wasn’t working. I just realized i wasn’t doing val(), just comparing it to DT.

Thank you for your help. Appreciate it :+1:

Also… I feel like the error message can be improved.