Skip to content

UseFormat

katanakit-js / 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.

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 {}).

string

The formatted date string.

useFormat("2024-06-15");