Fields

Date

Last updated

A screenshot of a date field in the Page Builder.

A date field in the Page Builder.

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

The date is saved in YYYY-MM-DD format, like 2026-05-22.

Date field values can be formatted and displayed like any JavaScript date using the asDate() helper from @prismicio/client.

import { asDate } from "@prismicio/client";

const date = asDate(slice.primary.release_date);

<span>{date?.toLocaleDateString("en-US")}</span>;

Add a date field to a content model

Date fields are added using the Type Builder, a tool for building by hand, or the Prismic CLI, a tool for AI agents.

Use date fields

Date fields can be used anywhere a date is needed. It is often helpful to first convert the date to a JavaScript Date object using asDate from @prismicio/client.

import { asDate } from "@prismicio/client";
import type { SliceComponentProps } from "@prismicio/react";

function Slice({ slice }: SliceComponentProps) {
  const date = asDate(slice.primary.release_date);

  return <span>{date?.toLocaleDateString("en-US")}</span>;
}

Check if a date field has a value

Use isFilled.date() to check if a date field has a value before using it.

import { isFilled } from "@prismicio/client";

if (isFilled.date(slice.primary.my_date_field)) {
  // Do something if `my_date_field` has a value.
}

Learn more about isFilled

API response

Here is what a date field looks like from the Content API:

{
  "example_date": "2030-01-31"
}
Was this page helpful?