The DateTimeFormat object is a constructor for objects that enable language-sensitive date and time formatting.

Documentation DateTimeFormat by Mozilla Contributors, licensed under CC-BY-SA 2.5.

Static methods

staticsupportedLocalesOf(locales:String, ?options:Null<DateTimeFormatSupportedLocalesOfOptions>):Array<String>

staticsupportedLocalesOf(locales:Array<String>, ?options:Null<DateTimeFormatSupportedLocalesOfOptions>):Array<String>

Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale.

Constructor

new(?locales:String, ?options:Null<DateTimeFormatOptions>)

new(?locales:Array<String>, ?options:Null<DateTimeFormatOptions>)

Methods

format(date:Date):String

format(date:Date):String

Getter function that formats a date according to the locale and formatting options of this DateTimeFormat object.

formatToParts(date:Date):Array<DateTimeFormatPart>

formatToParts(date:Date):Array<DateTimeFormatPart>

Returns an Array of objects representing the date string in parts that can be used for custom locale-aware formatting.

resolvedOptions():DateTimeFormatResolvedOptions

Returns a new object with properties reflecting the locale and formatting options computed during initialization of the object.