Using GraphQL Directives¶
Directive recipes against the Sample Application schema. For the full directive reference see Directives.
String Formatting¶
Number Formatting¶
Date Formatting¶
{
"data": {
"post": {
"title": "Getting Started with GraphQL and Django",
"createdAt": "December 01, 2023",
"publishedAt": "01/12/2023 14:30",
"updatedAt": "2023-12-01T14:30:00"
}
}
}
ISO format
@date(format: "iso") outputs the real ISO 8601 format
(%Y-%m-%dT%H:%M:%S — e.g. "2023-12-01T14:30:00"). Prior to v1.2.1
the output incorrectly used %Y-%b-%dT%H:%M:%S (abbreviated month name
such as "2023-Dec-01T14:30:00"), which is not valid ISO 8601.