-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs to include new ChronoTariff.
- Loading branch information
Showing
11 changed files
with
257 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [nifty-tou](./nifty-tou.md) > [ChronoTariff](./nifty-tou.chronotariff.md) > [(constructor)](./nifty-tou.chronotariff._constructor_.md) | ||
|
||
## ChronoTariff.(constructor) | ||
|
||
Constructor. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
constructor(chronoUnit: ChronoTariffUnit, rate: number, name?: string); | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| chronoUnit | [ChronoTariffUnit](./nifty-tou.chronotariffunit.md) | the chrono unit | | ||
| rate | number | the rate per chrono unit | | ||
| name | string | _(Optional)_ an optional description | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [nifty-tou](./nifty-tou.md) > [ChronoTariff](./nifty-tou.chronotariff.md) | ||
|
||
## ChronoTariff class | ||
|
||
A chronologically-based tariff, such as a "daily" charge. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export default class ChronoTariff | ||
``` | ||
|
||
## Constructors | ||
|
||
| Constructor | Modifiers | Description | | ||
| --- | --- | --- | | ||
| [(constructor)(chronoUnit, rate, name)](./nifty-tou.chronotariff._constructor_.md) | | Constructor. | | ||
|
||
## Properties | ||
|
||
| Property | Modifiers | Type | Description | | ||
| --- | --- | --- | --- | | ||
| [name](./nifty-tou.chronotariff.name.md) | <code>readonly</code> | string \| undefined | Get the optional name. | | ||
| [rate](./nifty-tou.chronotariff.rate.md) | <code>readonly</code> | number | Get the rate. | | ||
| [unit](./nifty-tou.chronotariff.unit.md) | <code>readonly</code> | [ChronoTariffUnit](./nifty-tou.chronotariffunit.md) | Get the unit. | | ||
|
||
## Methods | ||
|
||
| Method | Modifiers | Description | | ||
| --- | --- | --- | | ||
| [quantity(from, to, utc)](./nifty-tou.chronotariff.quantity.md) | | <p>Calcualte the count of units between two dates.</p><p>The cost of this tariff can be calculated by multiplying the <code>rate</code> by the result of this method, for example:</p> | ||
```ts | ||
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 | ||
``` | ||
| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [nifty-tou](./nifty-tou.md) > [ChronoTariff](./nifty-tou.chronotariff.md) > [name](./nifty-tou.chronotariff.name.md) | ||
|
||
## ChronoTariff.name property | ||
|
||
Get the optional name. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
get name(): string | undefined; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [nifty-tou](./nifty-tou.md) > [ChronoTariff](./nifty-tou.chronotariff.md) > [quantity](./nifty-tou.chronotariff.quantity.md) | ||
|
||
## ChronoTariff.quantity() method | ||
|
||
Calcualte 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: | ||
|
||
```ts | ||
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 | ||
``` | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
quantity(from: Date, to: Date, utc?: boolean): number; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| from | Date | the starting date | | ||
| to | Date | the ending date (exclusive) | | ||
| utc | boolean | _(Optional)_ if <code>true</code> then use UTC date components, otherwise assume the local time zone | | ||
|
||
**Returns:** | ||
|
||
number | ||
|
||
the count of units between `from` and `to`<!-- -->, including any fractional component | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [nifty-tou](./nifty-tou.md) > [ChronoTariff](./nifty-tou.chronotariff.md) > [rate](./nifty-tou.chronotariff.rate.md) | ||
|
||
## ChronoTariff.rate property | ||
|
||
Get the rate. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
get rate(): number; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [nifty-tou](./nifty-tou.md) > [ChronoTariff](./nifty-tou.chronotariff.md) > [unit](./nifty-tou.chronotariff.unit.md) | ||
|
||
## ChronoTariff.unit property | ||
|
||
Get the unit. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
get unit(): ChronoTariffUnit; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [nifty-tou](./nifty-tou.md) > [ChronoTariffUnit](./nifty-tou.chronotariffunit.md) | ||
|
||
## ChronoTariffUnit enum | ||
|
||
An enumeration of supported chronological tariff units of the Gregorian calendar. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export declare enum ChronoTariffUnit | ||
``` | ||
|
||
## Enumeration Members | ||
|
||
| Member | Value | Description | | ||
| --- | --- | --- | | ||
| DAYS | <code>0</code> | Days | | ||
| MONTHS | <code>2</code> | Months | | ||
| WEEKS | <code>1</code> | Weeks | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters