Class TemporalRangesTariffSchedule<T, O>

A schedule, or collection, of TemporalRangesTariff rules that supports resolving rates for dates.

Type Parameters

Hierarchy

Constructors

Properties

#options: undefined | O
#rules: readonly T[]

Accessors

Methods

  • Find the rules that apply on a given date.

    Parameters

    • date: Date

      the date to find the matching rules at

    • first: boolean

      true to return the first match, false to return all matches

    • Optional utc: boolean

      if true then use UTC date components, otherwise assume the local time zone

    Returns T[]

    the list of matching rules

  • Find the first rule that applies on a given date.

    Parameters

    • date: Date

      the date to find the first matching rule at

    • Optional utc: boolean

      if true then use UTC date components, otherwise assume the local time zone

    Returns undefined | T

    the first available matching rule, or undefined if no rules match

  • Find the rules that apply on a given date, repsecting the multipleMatch property.

    Parameters

    • date: Date

      the date to find the matching rules at

    • Optional utc: boolean

      if true then use UTC date components, otherwise assume the local time zone

    Returns T[]

    the list of matching rules; at most one if multipleMatch is false

  • Resolve the tariff rates that apply on a given date, respecting the multipleMatch property.

    Duplicate rate id values will override existing rates, so that the last-seen rate for a given id is the one returned.

    Parameters

    • date: Date

      the date to resolve

    • Optional utc: boolean

      if true then use UTC date components, otherwise assume the local time zone

    Returns Record<string, TariffRate>

    all tariff rates tha apply on the given date, as a Record of rate id values to associated rate instances

Generated using TypeDoc