Fields

Date and datetime

A calendar day, or a moment in time stored in UTC.
The date field in the admin

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>
  • A date has no time zone. Format it with timeZone: "UTC", or a visitor west of UTC sees the day before.
  • Format a datetime with the time zone of your audience, like timeZone: "Europe/Berlin". Without timeZone, the server's time zone is used, and that differs from the browser's.

Date or datetime

TypeStoresUse it for
dateA day without time and time zone, 2026-10-17Birthdays, deadlines, all-day events
datetimeA moment in UTC, 2026-10-17T12:00:00.000ZStart 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 datetime field in the admin

The admin picks a day from a calendar:

The date-open field in the admin

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.Shown in the empty input.