Class DateTimeFormat
java.lang.Object
org.jboss.elemento.intl.DateTimeFormat
@JsType(isNative=true,
namespace="<global>",
name="Intl.DateTimeFormat")
public class DateTimeFormat
extends Object
Mapping for
Intl.DateTimeFormat.
var date = new JsDate(2020, 11, 20, 3, 23, 16, 738);
// Specify default date formatting for language (locale)
console.log(dateTimeFormat("en-US").format(new JsDate()));
// Expected output: "12/20/2020"
// Specify a date and time format using "style" options (i.e. full, long, medium, short)
console.log(dateTimeFormat("en-GB", dateTimeFormatOptions()
.dateStyle(full)
.timeStyle(full)
.timeZone("Australia/Sydney")).format(date));
// Expected output: "Sunday, 20 December 2020 at 14:23:16 GMT+11"
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic DateTimeFormatstatic DateTimeFormatdateTimeFormat(String locale) static DateTimeFormatdateTimeFormat(String[] locales) static DateTimeFormatdateTimeFormat(String[] locales, DateTimeFormatOptions options) static DateTimeFormatdateTimeFormat(String locale, DateTimeFormatOptions options) static DateTimeFormatdateTimeFormat(DateTimeFormatOptions options) static DateTimeFormatdateTimeFormat(Locale locale) static DateTimeFormatdateTimeFormat(Locale[] locales) static DateTimeFormatdateTimeFormat(Locale[] locales, DateTimeFormatOptions options) static DateTimeFormatdateTimeFormat(Locale locale, DateTimeFormatOptions options) format(elemental2.core.JsDate date) formatRange(elemental2.core.JsDate start, elemental2.core.JsDate end) elemental2.core.JsArray<jsinterop.base.JsPropertyMap<String>> formatRangeToParts(elemental2.core.JsDate start, elemental2.core.JsDate end) elemental2.core.JsArray<jsinterop.base.JsPropertyMap<String>> formatToParts(elemental2.core.JsDate date) jsinterop.base.JsPropertyMap<String> static elemental2.core.JsArray<String> supportedLocalesOf(String locale) static elemental2.core.JsArray<String> supportedLocalesOf(String locale, SupportOptions options) static elemental2.core.JsArray<String> supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales) static elemental2.core.JsArray<String> supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales, SupportOptions options)
-
Method Details
-
dateTimeFormat
-
dateTimeFormat
-
dateTimeFormat
-
dateTimeFormat
-
dateTimeFormat
-
dateTimeFormat
-
dateTimeFormat
@JsOverlay public static DateTimeFormat dateTimeFormat(String locale, DateTimeFormatOptions options) -
dateTimeFormat
@JsOverlay public static DateTimeFormat dateTimeFormat(Locale locale, DateTimeFormatOptions options) -
dateTimeFormat
@JsOverlay public static DateTimeFormat dateTimeFormat(String[] locales, DateTimeFormatOptions options) -
dateTimeFormat
@JsOverlay public static DateTimeFormat dateTimeFormat(Locale[] locales, DateTimeFormatOptions options) -
supportedLocalesOf
-
supportedLocalesOf
public static elemental2.core.JsArray<String> supportedLocalesOf(String locale, SupportOptions options) -
supportedLocalesOf
-
supportedLocalesOf
public static elemental2.core.JsArray<String> supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales, SupportOptions options) -
format
-
formatToParts
public elemental2.core.JsArray<jsinterop.base.JsPropertyMap<String>> formatToParts(elemental2.core.JsDate date) -
formatRange
-
formatRangeToParts
public elemental2.core.JsArray<jsinterop.base.JsPropertyMap<String>> formatRangeToParts(elemental2.core.JsDate start, elemental2.core.JsDate end) -
resolvedOptions
-