Class Info

The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.

Hierarchy

  • Info

Constructors

Methods

  • Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.

    Example

    Info.eras() //=> [ 'BC', 'AD' ]
    

    Example

    Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]
    

    Example

    Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
    

    Returns

    Parameters

    • Optional length: StringUnitLength = "short"

      the length of the era representation, such as "short" or "long".

    • options: InfoOptions = {}

      options

    Returns string[]

  • Return the set of available features in this environment. Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. Keys:

    • relative: whether this environment supports relative time formatting

    Example

    Info.features() //=> { relative: false }
    

    Returns

    Returns Features

  • Return whether the specified zone contains a DST.

    Returns

    Parameters

    • Optional zone: ZoneLike = Settings.defaultZone

      Zone to check. Defaults to the environment's local zone.

    Returns boolean

  • Return whether the specified zone is a valid IANA specifier.

    Returns

    Parameters

    • zone: string

      Zone to check

    Returns boolean

  • Return an array of meridiems.

    Example

    Info.meridiems() //=> [ 'AM', 'PM' ]
    

    Example

    Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
    

    Returns

    Parameters

    Returns string[]

  • Return an array of format month names. Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that changes the string. See months

    Returns

    Parameters

    • Optional length: UnitLength = "long"

      the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"

    • opts: InfoCalendarOptions = {}

      options

    Returns string[]

  • Converts the input into a Zone instance.

    • If input is already a Zone instance, it is returned unchanged.
    • If input is a string containing a valid IANA time zone name, a Zone instance with that name is returned.
    • If input is the string "system", the system's time zone is returned.
    • If input is the string "default", the default time zone, as defined in Settings.defaultZone is returned.
    • If input is a string that doesn't refer to a known time zone, a Zone instance with isValid == false is returned.
    • If `input is a number, a Zone instance with the specified fixed offset in minutes is returned.
    • If input is null or undefined, the default zone is returned.

    Returns

    Parameters

    • Optional input: ZoneLike

      the value to be converted

    Returns Zone

  • Return an array of format week names. Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that changes the string. See Info#weekdays

    Returns

    Parameters

    • Optional length: StringUnitLength = "long"

      the length of the weekday representation, such as "narrow", "short", "long".

    • options: InfoUnitOptions = {}

      options

    Returns string[]

Generated using TypeDoc