Skip to content

Numbers and dates

Use Intl with the active language and explicit options for your data.

number and date

Inside a component ts
const { number, date } = useI18n()

number(12345.67, { style: 'currency', currency: 'USD' })
number(0.42, { style: 'percent' })

date(Date.UTC(2026, 0, 15, 12), {
  dateStyle: 'long',
  timeZone: 'UTC',
})

number accepts the options of Intl.NumberFormat; date, those of Intl.DateTimeFormat. The instances are reused per options within the translator.

Signatures of the formatters
Name Type / default Description
number (value: number, options?: Intl.NumberFormatOptions) => string Currencies, percentages, decimals and other numeric representations.
date (value: Date | number, options?: Intl.DateTimeFormatOptions) => string A date or timestamp, formatted for the active language.

Consistency between server and browser

Use the same date and set timeZone when the result must match in SSR and hydration. The playground uses a fixed date and UTC so you can compare the languages without depending on the clock or the time zone of the machine.

The currency is chosen with currency; the language defines how it is presented, not a currency conversion.

Compare formats

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters