Date Field

The Date field adheres to ISO 8601 standard, outlined in the section 5.6 of RFC 3339.

Sample Date Query

Query

{
events {
day
}
}

Output

{
"data": {
"events": [
{
"day": "2020-04-01"
},
{
"day": "2020-04-02"
}
]
}
}

Filtering by Date

Date filters support:

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

'day': 'DateTime'

{
events(where: { day: "2020-04-01" }) {
day
}
}

'day_not': 'DateTime'

{
events(where: { day_not: "2020-04-01" }) {
day
}
}

'day_in': '[DateTime!]'

{
events(where: { day_in: ["2020-04-01"] }) {
day
}
}

'day_not_in': '[DateTime!]'

{
events(where: { day_not_in: ["2020-04-01"] }) {
day
}
}

'day_lt': 'DateTime'

{
events(where: { day_lt: "2020-04-01" }) {
day
}
}

'day_lte': 'DateTime'

{
events(where: { day_lte: "2020-04-01" }) {
day
}
}

'day_gt': 'DateTime'

{
events(where: { day_gt: "2020-04-01" }) {
day
}
}

'day_gte': 'DateTime'

{
events(where: { day_gte: "2020-04-01" }) {
day
}
}

Mutating a Date

Mutation

mutation {
createEvent(data: { day: "2020-12-25" }) {
day
}
}

Output

{
"data": {
"createEvent": {
"day": "2020-12-25"
}
}
}

Were you expecting something more?

We are constantly contributing to our documentation, but if you spot something we're missing, let us know and we'll be sure to add it.

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