Beta Preview

useDateFormatter

Introduction

useDateFormatter wraps a builtin browser Intl.DateTimeFormat object to provide a React Hook that integrates with the i18n system in React Aria. It handles formatting dates for the current locale, updating when the locale changes, and caching of date formatters for performance. See the Intl.DateTimeFormat docs for information on formatting options.

Example

This example displays the current date for two locales: USA, and Russia. Two instances of the CurrentDate component are rendered, using the I18nProvider to specify the locale to display.

11/13/2025

13.11.2025

import {I18nProvider, useDateFormatter} from '@react-aria/i18n';

function CurrentDate() {
  let formatter = useDateFormatter();

  return (
    <p>{formatter.format(new Date())}</p>
  );
}

<>
  <I18nProvider locale="en-US">
    <CurrentDate />
  </I18nProvider>
  <I18nProvider locale="ru-RU">
    <CurrentDate />
  </I18nProvider>
</>

API

useDateFormatter(options?: ):

DateFormatterOptions

NameType
calendarstring

DateFormatter

constructor(locale: string, options: Intl.DateTimeFormatOptions): void
format(value: Date): string
Formats a date as a string according to the locale and format options passed to the constructor.
formatToParts(value: Date): Intl.DateTimeFormatPart[]
Formats a date to an array of parts such as separators, numbers, punctuation, and more.
formatRange(start: Date, end: Date): string
Formats a date range as a string.
formatRangeToParts(start: Date, end: Date): []
Formats a date range as an array of parts.
resolvedOptions(): Intl.ResolvedDateTimeFormatOptions
Returns the resolved formatting options based on the values passed to the constructor.