Date
An ISO-8601 formatted string containing date. E.g. 2017-02-12
.
Properties
REQUIREDtypestring
Required. Value must be set to
date
.REQUIREDnamestring
Required. The field name. This will be the key in the data record.
titlestring
Human readable label for the field.
boolean
If set to
true
, this field will be hidden in the studio.readOnlyboolean
If set to
true
, this field will not be editable in the content studio.descriptionstring
Short description to editors how the field is to be used.
Options
dateFormatstring
Controls how the date input field formats the displayed date. Use any valid Moment format option. Default is
YYYY-MM-DD
.calendarTodayLabelstring
Label for the "jump to today" button on the date input widget. Default is
Today
.
Validation
Learn more about validationrequired()
Ensures that this field exists.
custom(fn)
Creates a custom validation rule.
The stored date is represented as a string in compliance with ISO 8601 (often described as YYYY-MM-DD
).
Protip
If you need to store information about both date and time, use the datetime type instead.
Input
{
title: 'Release date',
name: 'releaseDate',
type: 'date'
}
Output
{
"releaseDate": "2017-02-12"
}
{
title: 'Release date',
name: 'releaseDate',
type: 'date',
options: {
dateFormat: 'YYYY-MM-DD',
calendarTodayLabel: 'Today'
}
}