Enables language-sensitive data and time formatting. Wraps Intl.DateTimeFormat

Constructors

Methods

  • Formats a date according to the locale and formatting option for this DateTimeFormat object

    Parameters

    • date: Date

      The date to format

    Returns string

    String representing the given date formatted according to the locale and formatting options of this DateTimeFormat object

  • Formats a date range in the most concise way based on the locales and options provided when instantiating this DateTimeFormat object

    Parameters

    • startDate: Date

      Date object representing start of the date range

    • endDate: Date

      Date object representing the end of the date range

    Returns string

    String representing the given date range formatted according to the locale and formatting options of this DateTimeFormat object

  • Returns an array of locale-specific tokens representing each part of the formatted date range produced by this DateTimeFormat object

    Parameters

    • startDate: Date

      Date object representing start of the date range

    • endDate: Date

      Date object representing the end of the date range

    Returns DateTimeRangeFormatPart[]

    Array of DateTimeRangeFormatPart objects

  • Allows locale-aware formatting of strings produced by this DateTimeFormat object

    Parameters

    • date: Date

      The date to format

    Returns DateTimeFormatPart[]

    Array of DateTimeFormatPart objects

  • Returns a new object with properties reflecting the locale and date and time formatting options computed during initialization of this DateTimeFormat object

    Returns ResolvedDateTimeFormatOptions

    ResolvedDateTimeFormatOptions object