Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.unstable.d.ts>Intl.DateTimeFormat

A modern runtime for JavaScript and TypeScript.
Latest
interface Intl.DateTimeFormat
import { type Intl } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.unstable.d.ts";
const { DateTimeFormat } = Intl;

Methods

format(date?: Formattable | number): string

Format a date into a string according to the locale and formatting options of this Intl.DateTimeFormat object.

formatToParts(date?: Formattable | number): globalThis.Intl.DateTimeFormatPart[]

Allow locale-aware formatting of strings produced by Intl.DateTimeFormat formatters.

formatRange<T extends Formattable>(startDate: T, endDate: T): string

Format a date range in the most concise way based on the locale and options provided when instantiating this Intl.DateTimeFormat object.

formatRange(startDate: Date | number, endDate: Date | number): string
formatRangeToParts<T extends Formattable>(startDate: T, endDate: T): DateTimeFormatRangePart[]

Allow locale-aware formatting of tokens representing each part of the formatted date range produced by Intl.DateTimeFormat formatters.

formatRangeToParts(startDate: Date | number, endDate: Date | number): DateTimeFormatRangePart[]