Templating the Date field

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

Default Format

Here's an example of how to access a Date value using the PrismicDOM.date object.

var PrismicDOM = require('prismic-dom');

var date = PrismicDOM.Date(document.data.postDate);

Custom Format

By saving the Date value as a Date object, you can format it using the built-in locale format function. Using a library such as Moment.js could also be a good idea if it fits your needs.

var date = PrismicDOM.Date(document.data.postDate);

var formattedDate = new Intl.DateTimeFormat('en-US',{
  year: "numeric",
  month: "short",
  day: "2-digit"
// Outputs the date in Mon dd, YYYY format