Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to format

§Return Type

§
string
[src]

The formatted date string

§
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.

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to format
§
  • An object with locale

§Return Type

§
string
[src]

The formatted date string

§
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

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to format
§
  • The format options

§Return Type

§
string
[src]

The formatted date string

§
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

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to format
§
  • The format options
§
  • An object with locale

§Return Type

§
string
[src]

The formatted date string