Created At Field

The Created At field adheres to ISO 8601 standard, outlined in th section 5.6 of RFC 3339. This is a system field.

Sample Created At Query

Query

{
shops {
title
createdAt
}
}

Output

{
"data": {
"shops": [
{
"title": "Happy Valley Coffee",
"createdAt": "2020-04-01T06:00:00+00:00"
},
{
"title": "Happy Mountain Tea",
"createdAt": "2020-04-01T07:00:00+00:00"
},
{
"title": "Route 66 Coffee Stop",
"createdAt": "2020-04-01T08:00:00+00:00"
},
{
"title": "Dick's Coffee",
"createdAt": "1987-04-01T09:00:00+00:00"
}
]
}
}

Filtering by Created At

Created At filters support:

  • _not
  • _in
  • _not_in
  • _lt
  • _lte
  • _gt
  • _gte

'createdAt': 'DateTime'

{
shop(where: { createdAt: "2020-04-01T09:00:00+00:00" }) {
title
createdAt
}
}

'createdAt_not': 'DateTime'

{
shop(where: { createdAt_not: "2020-04-01T09:00:00+00:00" }) {
title
createdAt
}
}

'createdAt_in': '[DateTime!]'

{
shop(where: { createdAt_in: ["2020-04-01T09:00:00+00:00"] }) {
title
createdAt
}
}

'createdAt_not_in': '[DateTime!]'

{
shop(where: { createdAt_not_in: ["2020-04-01T09:00:00+00:00"] }) {
title
createdAt
}
}

'createdAt_lt': 'DateTime'

{
shop(where: { createdAt_lt: "2020-04-01T09:00:00+00:00" }) {
title
createdAt
}
}

'createdAt_lte': 'DateTime'

{
shop(where: { createdAt_lte: "2020-04-01T09:00:00+00:00" }) {
title
createdAt
}
}

'createdAt_gt': 'DateTime'

{
shop(where: { createdAt_gt: "2020-04-01T09:00:00+00:00" }) {
title
createdAt
}
}

'createdAt_gte': 'DateTime'

{
shop(where: { createdAt_gte: "2020-04-01T09:00:00+00:00" }) {
title
createdAt
}
}

Mutating a Date

This is a system field and the values will be generated for you if left blank

Mutation

mutation {
createShop(
data: { title: "Dick's Coffee", createdAt: "1987-04-01T06:00:00+00:00" }
) {
title
createdAt
}
}

Output

{
"data": {
"createShop": {
"title": "Dick's Coffee",
"createdAt": "1987-04-01T06:00:00+00:00"
}
}
}

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy