Is there any documentation on what Postgres operators are available when querying/setting dates/times? It's awesome that I can make a query like this (note the now() in where and _set):
mutation ConfirmEmail($token: String!) {
update_email_confirmation(
where: { token: { _eq: $token }, created_at: { _lt: "now()" } }
_set: { confirmed_at: "now()" }
) {
returning {
email_confirmation_id
email
created_at
confirmed_at
}
}
}
I'd love to be able to subtract 30 days from the now() in the where clause, e.g.:
mutation ConfirmEmail($token: String!) {
update_email_confirmation(
where: { token: { _eq: $token }, created_at: { _gt: "now() - interval '29' day" } }
_set: { confirmed_at: "now()" }
) {
returning {
email_confirmation_id
email
created_at
confirmed_at
}
}
}
But I'm missing something, or this isn't yet supported:
{
"errors": [
{
"extensions": {
"path": "$",
"code": "data-exception"
},
"message": "invalid input syntax for type timestamp with time zone: \"now() - interval '29' day\""
}
]
}
Anyone have any hints on how I can query for something "within the past 30 days"?
Make a view that filters by 30 day, thats one option.
Related to #2699
Closing this in favour of #2699 馃檪
This big issue makes "Hasura" almost worthless thing. We may not use "intervals" for datetime comparisons in "where" clause. BAD.
@Taho2007 your comment sounds like a typical donald trump tweet..
anyway, the date functionality would be greatly appreciated. though, it's not too hard to make it work on implementation side.
Most helpful comment
@Taho2007 your comment sounds like a typical donald trump tweet..
anyway, the date functionality would be greatly appreciated. though, it's not too hard to make it work on implementation side.