Function: useFormat()
useFormat(
dateInput,locale?,options?):string
Defined in: src/core/services/dates.service.ts:57
Formats a date input into a localised string using Intl.DateTimeFormat.
Accepts epoch milliseconds, ISO strings, native Date objects,
Temporal.Instant, or any Temporal date/time type.
Parameters
dateInput
The value to format.
locale?
Locale = "en"
BCP 47 locale tag (defaults to "en").
options?
DateTimeFormatOptions = {}
Intl.DateTimeFormatOptions (defaults to {}).
Returns
string
The formatted date string.
Throws
If the input cannot be parsed as a date.
Example
useFormat("2024-06-15"); // "6/15/2024" (en-US)
useFormat(Date.now(), "es", { dateStyle: "full" }); // "sábado, 15 de junio de 2024"