Skip to main content

DateField

Displays a date or a datetime in the admin locale.

showTime decides whether the time part is rendered; the schema turns it on for format: "date-time". For a time-only value the dispatcher picks TimeField instead.

Example​

<DateField source="created_at" showTime />

Props​

On top of locales and showTime the component accepts the shared field props.

NameTypeDefaultDescription
source (required)string—Name of the field on the record
showTimebooleanfalseAppends the time part
localesstringadmin localeLocale used to format the value
emptyTextstring—Text shown when the value is empty

The value never wraps — the component forces white-space: nowrap so a list column keeps one row per record. options is not forwarded to the underlying React Admin field.

Schema mapping​

type: "string" with format: "date" or format: "date-time":

{"name": "created_at", "type": "string", "format": "date-time", "sortable": true}

DRF's DateField / DateTimeField — that is, any models.DateField or models.DateTimeField — map to the two formats:

class Order(models.Model):
placed_at = models.DateTimeField(auto_now_add=True)
delivery_on = models.DateField(null=True, blank=True)

See also​