Constructor.
Optional
yearRange: IntRangethe year range
Optional
monthRange: IntRangethe month range (1-12, inclusive)
Optional
dayOfMonthRange: IntRangethe day of month range (1-31, inclusive)
Optional
dayOfWeekRange: IntRangethe day of week range (1-7, with 1 = Monday, 7 = Sunday, inclusive)
Optional
minuteOfDayRange: IntRangethe minute of day range (0-1440, inclusive minimum, exclusive maximum)
Optional
rates: TariffRate[]the rates, as an array of TariffRate
objects
Private
Optional
#dayPrivate
Optional
#dayPrivate
Optional
#minutePrivate
Optional
#monthPrivate
#ratesPrivate
Optional
#yearGet the rates, as an object of rate ID to TariffRate
objects.
Static
ALL_Static
ALL_Static
ALL_Static
ALL_Private
#datePrivate
#datePrivate
#rangeTest if an optional range contains a value.
the number to test if the range contains
Optional
range: IntRangethe range to test
Optional
exclusiveEnd: booleanif true
then treat the range end as an exclusive bound
true
if the given range is not defined, or it contains the given value
Private
#yearTest if an optional year range contains a value.
the number to test if the range contains
Optional
range: IntRangethe range to test
true
if the given range is not defined, or it contains the given value
Private
#yearTest if an optional year range contains a value, with the range maximum treated as unbounded.
the number to test if the range contains
Optional
range: IntRangethe range to test
true
if the given range is not defined, or it contains the given value
Test if this tariff applies on a given date.
All range constraints are treated as inclusive bounds, except for
the minuteOfDayRange
that is treated as an inclusive minimum and
exclusive maximum.
the date to test if this rate applies at
Optional
utc: booleanif true
then use UTC date components, otherwise assume the local time zone
true
if this tariff applies on the given date
Test if this tariff applies on a given date.
All range constraints are treated as inclusive bounds, except for
the minuteOfDayRange
that is treated as an inclusive minimum and
exclusive maximum.
the date to test if this rate applies at
Optional
utc: booleanif true
then use UTC date components, otherwise assume the local time zone
true
if this tariff applies on the given date
Compares this object with the specified object for order.
Unbounded (null
) values are ordered before bounded (non-null
) values.
the tariff to compare to
-1
, 0
, or 1
if this is less than, equal to, or greater than o
Protected
componentsFormat a field range into a locale-specific string.
the desired locale
the field to format
Optional
options: TemporalRangesTariffFormatOptionsthe formatting options
the formatted field range value
TypeError
if field
is not supported
Get a string representation.
the string representation
This method will call the componentsDescription() method to generate a string representation of this tariff.
Static
formatFormat a field range value into a locale-specific string.
the desired locale
the field to format
Optional
value: IntRangethe field value to format; if undefined then "all possible values" will be assumed
Optional
options: TemporalRangesTariffFormatOptionsthe options
the formatted field range value
TypeError
if field
is not supported
Static
parseParse time range criteria into a TemporalRangesTariff
instance.
the locale to parse the ranges as
Optional
monthRange: stringthe month range to parse, for example January-December
, Jan-Dec
, or 1-12
Optional
dayOfMonthRange: stringthe day of month range to parse, for example 1-31
Optional
dayOfWeekRange: stringthe day of week range to parse, for example Monday-Sunday
, Mon-Sun
, or 1-7
Optional
minuteOfDayRange: stringthe minute of day range to parse, for example 00:00-24:00
or 0-24
Optional
rates: TariffRate[]the tariff rates to associate with the time range criteria
Optional
options: TemporalRangesTariffFormatOptionsthe formatting options to use
the new instance
Note that the minuteOfDayRange
can be specified as a range of HH:MM
24-hour hour and minute
values, or whole hours. For example 01:00-08:00
and 1-8
are equivalent.
Additionally, all range values may be specified as *
to mean "all possible values", in which
that range will be resolved to undefined
.
Static
parseParse time range criteria into a YearTemporalRangesTariff
instance.
the locale to parse the ranges as
Optional
yearRange: stringthe year range to parse, for example 2000-2023
Optional
monthRange: stringthe month range to parse, for example January-December
, Jan-Dec
, or 1-12
Optional
dayOfMonthRange: stringthe day of month range to parse, for example 1-31
Optional
dayOfWeekRange: stringthe day of week range to parse, for example Monday-Sunday
, Mon-Sun
, or 1-7
Optional
minuteOfDayRange: stringthe minute of day range to parse, for example 00:00-24:00
or 0-24
Optional
rates: TariffRate[]the tariff rates to associate with the time range criteria
Optional
options: TemporalRangesTariffFormatOptionsthe formatting options
the new instance
Note that the minuteOfDayRange
can be specified as a range of HH:MM
24-hour hour and minute
values, or whole hours. For example 01:00-08:00
and 1-8
are equivalent.
Additionally, all range values may be specified as *
to mean "all possible values", in which
that range will be resolved to undefined
.
Generated using TypeDoc
An extension of TemporalRangesTariff with support for an additional year range constraint.