Skip to content
0

katanakit-js / useFormat

Function: useFormat() ​

ts
function useFormat(
   dateInput, 
   locale?, 
   options?
): string;

Defined in: src/core/services/dates.service.ts:590

Formats a date input into a localised string using Intl.DateTimeFormat.

Parameters ​

ParameterTypeDefault valueDescription
dateInputTemporalInputundefinedThe value to format.
locale"en" | "es" | "fr" | "de" | "it" | "pt" | "ja" | "zh""en"BCP 47 locale tag (defaults to "en").
optionsDateTimeFormatOptions{}Intl.DateTimeFormatOptions (defaults to {}).

Returns ​

string

The formatted date string.

Example ​

ts
useFormat("2024-06-15");

Released under the MIT License.