Internalization (I18n)
The Formatter
class uses the Intl.DateTimeFormat
API for internationalization (I18n). This means that you can use the locale
option to format dates and times in different languages.
TIP
For detailed information on formatting dates and times and how to use the Formatter
class, visit the Date/Time Formatting section.
ts
import { Formatter } from 'prayer-call'
const formatter = new Formatter({
locale: 'fr-FR',
dateStyle: 'full',
timeStyle: 'short',
})
const date = new Date(2022, 1, 1)
formatter.formatDate(date) // 'mardi 1 février 2022 à 00:00'
import { Formatter } from 'prayer-call'
const formatter = new Formatter({
locale: 'fr-FR',
dateStyle: 'full',
timeStyle: 'short',
})
const date = new Date(2022, 1, 1)
formatter.formatDate(date) // 'mardi 1 février 2022 à 00:00'
TIP
For the general form and interpretation of the locales argument, see the parameter description on the Intl
main page.