Skip to content
Nana UI

Format Date

View .md Download

Formats a date with Intl — relative (“2 days ago”), short/medium/long absolute, or ISO.

Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/format-date";
<nana-format-date date="2026-07-18" month="long" day="numeric" year="numeric"></nana-format-date>

Properties

PropertyAttributeTypeDefaultDescription
dateDate | string | numbernew Date()The date — a `Date`, an ISO string, or a timestamp
formatFormatDateFormat'medium'How to render the date
localestring | undefinedBCP 47 locale (defaults to the document locale)
Explore Format Date interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook