intlFormat
import { intlFormat } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Represent 4 October 2019 in middle-endian format:
const result = intlFormat(new Date(2019, 9, 4, 12, 30, 13, 456))
//=> 10/4/2019
function intlFormat<DateType extends Date>(date: DateType | number | string): string;
function intlFormat<DateType extends Date>(date: DateType | number | string, localeOptions: IntlFormatLocaleOptions): string;
function intlFormat<DateType extends Date>(date: DateType | number | string, formatOptions: IntlFormatFormatOptions): string;
function intlFormat<DateType extends Date>(
date: DateType | number | string,
formatOptions: IntlFormatFormatOptions,
localeOptions: IntlFormatLocaleOptions,
): string;§
intlFormat<DateType extends Date>(date: DateType | number | string): string
[src]@example
// Represent 4 October 2019 in middle-endian format:
const result = intlFormat(new Date(2019, 9, 4, 12, 30, 13, 456))
//=> 10/4/2019
§
intlFormat<DateType extends Date>(date: DateType | number | string, localeOptions: IntlFormatLocaleOptions): string
[src]@example
// Represent 4 October 2019 in Korean.
// Convert the date with locale's options.
const result = intlFormat(new Date(2019, 9, 4, 12, 30, 13, 456), {
locale: 'ko-KR',
})
//=> 2019. 10. 4.
§Parameters
§
localeOptions: IntlFormatLocaleOptions
[src]- An object with locale
§
intlFormat<DateType extends Date>(date: DateType | number | string, formatOptions: IntlFormatFormatOptions): string
[src]@example
// Represent 4 October 2019.
// Convert the date with format's options.
const result = intlFormat.default(new Date(2019, 9, 4, 12, 30, 13, 456), {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
})
//=> 10/4/2019, 12 PM
§Parameters
§
formatOptions: IntlFormatFormatOptions
[src]- The format options
§
intlFormat<DateType extends Date>(date: DateType | number | string, formatOptions: IntlFormatFormatOptions, localeOptions: IntlFormatLocaleOptions): string
[src]@example
// Represent 4 October 2019 in German.
// Convert the date with format's options and locale's options.
const result = intlFormat(new Date(2019, 9, 4, 12, 30, 13, 456), {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric',
}, {
locale: 'de-DE',
})
//=> Freitag, 4. Oktober 2019
§Parameters
§
formatOptions: IntlFormatFormatOptions
[src]- The format options
§
localeOptions: IntlFormatLocaleOptions
[src]- An object with locale