Time type fields are, like the name suggests, useful for storing time. Additional validations can be added to make it conform to particular range of times.
In the graph
Create a time field by simply creating a new field and marking the input type as Time.
Additional Properties
Property | Description | Possible Values |
---|---|---|
Default Value | The default value for this field when no value is provided. | Any Time |
Required | Whether the value is a required field. Can be set in the Validations section |
Validations
The time field supports validations only on the time value
Operate On | Possible Conditions | Possible Values |
---|---|---|
Time | > , >= ,= ,<= ,< |
Any Time |
Multiple validations can be chained together with
AND
operations
See Field Validations for more information on how to add validations.
In the CMS
When you publish a time field, it's available in the Content Management System as a simple time input. The user can enter any arbitrary time matching the validations set in the graph.
In the API
In the API the output response for this field is a time (unix timetamp)
.
Sample GraphQL Request
{
movies {
title
releaseTime # Marked as a time field
}
}
Sample GraphQL Response
{
"data": {
"movies": [
{
"title": "Superman vs. Spiderman",
"time": 1283791647817
// a date timetamp that can be easily
// converted to a Time object for manipulation
}
]
}
}