Fields
Date and datetime
A calendar day, or a moment in time stored in UTC.

Example
cms/collections/events.ts
export const events = defineCollection({
fields: {
title: { type: "text", required: true },
day: { type: "date", required: true },
startsAt: { type: "datetime" },
},
});
Both read as ISO strings:
event.day; // "2026-10-17"
event.startsAt; // "2026-10-17T12:00:00.000Z"
Render it
<time datetime={event.day}>
{new Date(event.day).toLocaleDateString("en", { dateStyle: "long", timeZone: "UTC" })}
</time>
<template>
<time :datetime="event.day">
{{ new Date(event.day).toLocaleDateString("en", { dateStyle: "long", timeZone: "UTC" }) }}
</time>
</template>
<time dateTime={event.day}>
{new Date(event.day).toLocaleDateString("en", { dateStyle: "long", timeZone: "UTC" })}
</time>
- A
datehas no time zone. Format it withtimeZone: "UTC", or a visitor west of UTC sees the day before. - Format a
datetimewith the time zone of your audience, liketimeZone: "Europe/Berlin". WithouttimeZone, the server's time zone is used, and that differs from the browser's.
Date or datetime
| Type | Stores | Use it for |
|---|---|---|
date | A day without time and time zone, 2026-10-17 | Birthdays, deadlines, all-day events |
datetime | A moment in UTC, 2026-10-17T12:00:00.000Z | Start times, publish times |
The admin shows a datetime in the editor's time zone and saves it in UTC. A date is the same day everywhere.

The admin picks a day from a calendar:

Sort and compare
ISO strings sort in time order, so you can compare them as strings:
const today = new Date().toISOString().slice(0, 10);
const upcoming = (await cms.find("events"))
.filter((event) => event.day >= today)
.sort((a, b) => a.day.localeCompare(b.day));
A filter matches one exact value, like where: { day: "2026-10-17" }.
Options
date is a calendar day. datetime is a moment in UTC.Every field type takes these options. See the fields overview for examples and validation.
label
string | { en, de, … }
The label in the admin. Defaults to the key. Pass an object to translate it.
description
string | { en, de, … }
Help text below the input.
required
boolean
The value MUST be present. A list needs at least one item.
default
value | ({ user, … }) => value
The value of a new document, when the field is missing. A plain value also fills the new form in the admin. A function, like
({ user }) => user?.id, runs on the server only.unique
boolean
No other document of the collection has the same value. See Validation .
validate
(value, args) => true | string
Your own check. See Your own checks .
condition
Condition
Show the field only when other values match. See Conditions .
private
boolean
Public reads leave the value out. Signed-in users and server code see it.
access
{ read, create, update }
Who can read and write this field. See Access control .
localized
false
In a localized collection, every field is stored per language. Localization .
false shares this field between languages. Only on top-level fields. See hooks
FieldHooks
Functions that run for this field on every write and read, before the collection's hooks. See Hooks .
hidden
boolean
Admin only
The admin does not show the input. The value still saves. Use it for values a hook sets.
readOnly
boolean
Admin only
The admin shows the input disabled. Code and hooks can still write it.
width
"1/4" | "1/3" | "1/2" | "2/3" | "3/4" | "full"
Admin only
The share of the row the field takes. Fields next to each other fill a row. In a narrow form, every field takes the full width. Default
"full".separator
true | string
Admin only
A line above the field, to break up a long form. A string adds a heading above the line.
tab
string | string[]
Admin only
The tab that shows this field. Define the tabs with
tabs on the collection, global, group or list item.fieldset
string
Admin only
The box that holds this field. Define the boxes with
fieldsets.

