Options
All
  • Public
  • Public/Protected
  • All
Menu

Angular injectable version of the IntlAdapter class

Hierarchy

  • IntlAdapter
    • IntlAdapterService

Index

Properties

defaultLocaleId

defaultLocaleId: string

Gets the browsers current locale

Methods

compare

  • compare(x: string, y: string, locale: string | string[] | undefined, options: CollatorOptions): number
  • Adapter to the Intl.Collator.compate() method. See Collator for details.

    Parameters

    • x: string
    • y: string
    • locale: string | string[] | undefined
    • options: CollatorOptions

    Returns number

formatDate

  • formatDate(value: Date | number | string, locale: string | string[] | undefined, options: DateTimeFormatOptions): string
  • Adapter to the Intl.DateTimeFormat.formatDate() method. See DateTimeFormat for details.

    Parameters

    • value: Date | number | string
    • locale: string | string[] | undefined
    • options: DateTimeFormatOptions

    Returns string

formatDateRange

  • formatDateRange(start: Date | number | string, end: Date | number | string, locale?: string | string[], options?: DateTimeFormatOptions): string
  • Formats a date range using the specified culture settings, e.g. 2019-11-15, 2019-11-15, 'en' => 'Fri, Nov 15, 2019' 2019-11-15, 2019-11-20, 'en' => 'Nov 15-20, 2019' 2019-11-15, 2019-12-20, 'en' => 'Nov 15-Dec 20, 2019'

    Parameters

    • start: Date | number | string

      the start date.

    • end: Date | number | string

      the end date.

    • Optional locale: string | string[]

      the locale used to format.

    • Optional options: DateTimeFormatOptions

      the option overrides for day, month, year and weekday formats. See DateTimeFormat for details.

    Returns string

formatDateToParts

  • formatDateToParts(value: Date | number | string, locale: string, options: DateTimeFormatOptions): DateTimeFormatPart[]
  • Adapter to the Intl.DateTimeFormat.formatDateToParts() method. See DateTimeFormat for details.

    Parameters

    • value: Date | number | string
    • locale: string
    • options: DateTimeFormatOptions

    Returns DateTimeFormatPart[]

formatNumber

  • formatNumber(value: number, locale: string | string[] | undefined, options: NumberFormatOptions): string
  • Adapter to the Intl.NumberFormat.formatNumber() method. See NumberFormat for details.

    Parameters

    • value: number
    • locale: string | string[] | undefined
    • options: NumberFormatOptions

    Returns string

formatTimeRange

  • formatTimeRange(start: Date | number | string, end: Date | number | string, locale?: string | string[], options?: DateTimeFormatOptions): string
  • Formats a time range using the specified culture settings, e.g. 2019-11-15 08:20, 2019-11-15 09:40, 'de' => 'Fr., 15. Nov. 2019, 08:20-09:40' 2019-11-15 08:20, 2019-11-16 09:40, 'de' => 'Fr., 15. Nov. 2019, 08:20-Sa., 16. Nov. 2019, 09:40'

    Parameters

    • start: Date | number | string

      the start date and time.

    • end: Date | number | string

      the end date and time.

    • Optional locale: string | string[]

      the locale used to format.

    • Optional options: DateTimeFormatOptions

      the option overrides for day, month, year, weekday, hour, minute and second formats. See DateTimeFormat for details.

    Returns string

parseDate

  • parseDate(date: string, locale: string, defaultValue?: Date): Date
  • Parses a numeric date string using the date rules of the specified culture.

    Parameters

    • date: string

      The date string to parse, e.g. 22

    • locale: string

      The locale to use for parsing.

    • Optional defaultValue: Date

      An optional default value used to fill the missing parts.

    Returns Date

Generated using TypeDoc