formatDate
Commons
stable
Format a Date object using a named format string (e.g. "fullDate", "shortDate", "monthAndYear") with locale-aware output via Intl.DateTimeFormat. Supports custom format functions via a formats map.
API
Signature
Signature TypeScript complète, extraite du fichier util.
A simpler overload also exists in packages/ds/src/utils/Calendar/date.util.ts with signature (date, locale, options: Intl.DateTimeFormatOptions) for direct Intl option objects.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- daterequisDate
- localerequisstring
- BCP 47 locale tag used by Intl.DateTimeFormat, e.g. 'en-US' or 'fr-FR'.
- optionsrequisIntl.DateTimeFormatOptions
API
Valeur de retour
La valeur retournée par cet util.
- Locale-formatted date string.
Usage
Exemples
Extraits de code prêts à coller.
Format using a named preset