UseFormat
katanakit-js / useFormat
Function: useFormat()
Section titled “Function: useFormat()”function useFormat( dateInput, locale?, options?): string;Defined in: core/services/dates.service.ts:590
Formats a date input into a localised string using Intl.DateTimeFormat.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
dateInput |
TemporalInput |
undefined |
The value to format. |
locale? |
"en" | "es" | "fr" | "de" | "it" | "pt" | "ja" | "zh" |
"en" |
BCP 47 locale tag (defaults to "en"). |
options? |
DateTimeFormatOptions |
{} |
Intl.DateTimeFormatOptions (defaults to {}). |
Returns
Section titled “Returns”string
The formatted date string.
Example
Section titled “Example”useFormat("2024-06-15");