Date Field Reference

This article explains what the Date field is and how to configure it in the Custom Type builder.


The Date field allows content writers to add a date that represents a calendar day.

Screenshot of a Date field in the drag-and-drop editor.

Date vs. Timestamp

This field is different from the Timestamp field, which includes both a date and a time.

The visual builder

When configuring a Date field you'll see the options to set the Field name, API ID, and Field placeholder.

Slice Machine vs. Legacy Editor

Editing fields is almost identical in Slice Machine and the Legacy editor. But it is important to know that the mock config option (to add data to preview content fields in the Slice Simulator) is only available in Slice Machine.

Screenshot of the Date field editor.

JSON model

The following table displays the JSON keys and values of the field’s 'API response.

Edit the JSON model with caution

Only edit the JSON model to make changes to the Rich Text field labels. Making abrupt changes can cause conflicts when synchronizing changes with your documents.

type

string (required)

Value must be Date

config

object

Object for the configuration options

config.label

string

The label that shows up for the field in the document editor

config.default
string

If set to now, it will automatically fill with today's date.

The default value will only apply to newly created documents. When you set or change the default value, it will not change existing documents.

Example JSON configuration

The following JSON defines is a Date field with a default value of today’s date.

Copy
"example_date" : {
  "type" : "Date",
  "config" : {
    "label" : "Release Date",
    "default" : "now"
  }
}

API response example

Here is an API response example of a Date field with the API ID of example_date:

Copy
// API response example of a Date field

{
 //...
 "example_date": "2022-10-22"
}

Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Spot an error in the documentation? Get in touch with us on our Community Forum or using the feedback form above.