Constructor.
the chrono unit
the rate per chrono unit
Optional
name: stringan optional description
Private
Optional
#nameAn optional name to associate with the tariff.
Private
#rateThe rate applied per time unit.
Private
#unitThe tariff time unit.
Get the optional name.
Get the rate.
Get the unit.
Private
#dayPrivate
#monthPrivate
#timePrivate
#weekCalcualte the count of units between two dates.
The cost of this tariff can be calculated by multiplying the rate
by the result
of this method, for example:
const tariff = new ChronoTariff(ChronoTariffUnit.DAYS, 10);
tariff.rate * tariff.quantity(
new Date('2024-01-01T00:00:00Z'),
new Date('2024-01-08T00:00:00Z'),
true) === 70; // 7 days @ 10/day
the starting date
the ending date (exclusive)
Optional
utc: booleanif true
then use UTC date components, otherwise assume the local time zone
the count of units between from
and to
, including any fractional component
Generated using TypeDoc
A chronologically-based tariff, such as a "daily" charge.