toLocaleString
Returns a localized date string.
toLocaleString()
Wrapper over native Date object's toLocaleString method with improved type system.
Signature
toLocaleString(locales?: LocalesArguments, options?: DateTimeFormatOptions): stringParameters
locale:Localestring(s)options: EnhancedIntl.DateTimeFormatoptions
Type Definitions
/** `BCP47` locale string or `Intl.Locale` object that contain one or more language or locale tags */
type $LocalArguments = LooseLiteral<LocaleCode | Split<LocaleCode, '-'>[0]> | Intl.Locale;
/** `BCP47` locale string, array of locale strings, `Intl.Locale` object, or array of `Intl.Locale` objects that contain one or more language or locale tags. */
type LocalesArguments = $LocalArguments | $LocalArguments[];
/** Locale calendars supported by `Intl` API */
type LocaleCalendar = 'buddhist' |'chinese' | 'coptic' | 'ethiopic' | 'gregory' | 'hebrew' | 'indian' | 'islamic' | ... ;
/** Locale numbering systems supported by `Intl` API */
type NumberingSystem = 'adlm' | 'ahom' | 'arab' | 'arabext' | 'bali' | 'beng' | 'bhks' | 'brah' | 'cakm' | 'cham' | ... ;
/** Extends `Intl.DateTimeFormatOptions` with improved type system. */
interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {
/** Time zone identifier to use. */
timeZone?: $TimeZoneIdentifier;
/** Locale calendar system to use. */
calendar?: LocaleCalendar;
/** Locale numbering system to use. */
numberingSystem?: NumberingSystem;
}Return Type
string - Localized date string
Notes
- Wrapper around native
Date.toLocaleString()
Example
playground.ts
Last updated: Wed, May 20, 2026 05:52:22PM (UTC)
