• Formats a given ISO 8601 date string according to specified or default locale and options. The function has a hardcoded time zone of 'Europe/Berlin'.

    Parameters

    • iso8601Date: string

      The ISO 8601 date string to format.

    • locale: string = 'de-DE'

      (Optional) A string with a BCP 47 language tag, or an array of such strings. Default is 'de-DE'.

    • Optional options: DateTimeFormatOptions

      (Optional) An object that contains Intl.DateTimeFormat options. Default format options are: { year: 'numeric', month: '2-digit', day: '2-digit' }

    Returns string

    A string representing the formatted date and time.

    Example

    // Returns "Do., 23 Nov. 2023, 23:59"
    formatDateWithLocale('2023-11-22T23:00:00+00:00')

    Example

    // Returns "Thu, 11/23/2023, 11:59 PM"
    formatDateWithLocale('2023-11-22T23:00:00+00:00', 'en-US', { weekday: 'short', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: true })

Generated using TypeDoc