Class Settings

Settings contains static getters and setters that control TsLuxon's overall behavior. TSLuxon is a simple library with few options, but the ones it does have live here.

Hierarchy

  • Settings

Constructors

Accessors

  • get defaultLocale(): undefined | string
  • Get the default locale to create DateTimes with. Does not affect existing instances.

    Returns undefined | string

  • set defaultLocale(locale: undefined | string): void
  • Set the default locale to create DateTimes with. Does not affect existing instances.

    Parameters

    • locale: undefined | string

    Returns void

  • get defaultNumberingSystem(): undefined | NumberingSystem
  • Get the default numbering system to create DateTimes with. Does not affect existing instances.

    Returns undefined | NumberingSystem

  • set defaultNumberingSystem(numberingSystem: undefined | NumberingSystem): void
  • Set the default numbering system to create DateTimes with. Does not affect existing instances.

    Parameters

    Returns void

  • get defaultOutputCalendar(): undefined | CalendarSystem
  • Get the default output calendar to create DateTimes with. Does not affect existing instances.

    Returns undefined | CalendarSystem

  • set defaultOutputCalendar(outputCalendar: undefined | CalendarSystem): void
  • Set the default output calendar to create DateTimes with. Does not affect existing instances.

    Parameters

    Returns void

  • get defaultZone(): Zone
  • Get the default time zone object to create DateTimes in. Does not affect existing instances.

    Returns Zone

  • set defaultZone(zone: Zone): void
  • [TS] had to use type Zone here. I created another setter to use a ZoneLike instead Let's face it. This is ugly. The original should have this approach as well. Set the default time zone to create DateTimes in. Does not affect existing instances. Use the value "system" to reset this value to the system's time zone.

    Parameters

    Returns void

  • set defaultZoneLike(zone: ZoneLike): void
  • [TS] can't use the real setter here because set and get must have the same type. Let's face this. This is bullshit. But I get that you want to make life easier for users. Set the default time zone to create DateTimes in. Does not affect existing instances. Use the value "system" to reset this value to the system's time zone.

    Parameters

    Returns void

  • get now(): (() => number)
  • Get the callback for returning the current timestamp.

    Returns (() => number)

      • (): number
      • Returns number

  • set now(n: (() => number)): void
  • Set the callback for returning the current timestamp. The function should return a number, which will be interpreted as an Epoch millisecond count

    Example

    Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future
    

    Example

    Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
    

    Parameters

    • n: (() => number)
        • (): number
        • Returns number

    Returns void

  • get throwOnInvalid(): boolean
  • Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals

    Returns boolean

  • set throwOnInvalid(t: boolean): void
  • Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals

    Parameters

    • t: boolean

    Returns void

Methods

  • Reset Luxon's global caches. Should only be necessary in testing scenarios.

    Returns

    Returns void

Generated using TypeDoc