Skip to content

Commit

Permalink
Rebuild.
Browse files Browse the repository at this point in the history
  • Loading branch information
msqr committed Oct 30, 2023
1 parent 1410a3f commit 961f518
Show file tree
Hide file tree
Showing 8 changed files with 346 additions and 2 deletions.
54 changes: 54 additions & 0 deletions lib/main/ChronoTariff.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* An enumeration of supported chronological tariff units of the Gregorian calendar.
* @public
*/
export declare enum ChronoTariffUnit {
/** Days */
DAYS = 0,
/** Weeks */
WEEKS = 1,
/** Months */
MONTHS = 2
}
/**
* A chronologically-based tariff, such as a "daily" charge.
* @public
*/
export default class ChronoTariff {
#private;
/**
* Constructor.
*
* @param chronoUnit - the chrono unit
* @param rate - the rate per chrono unit
* @param name - an optional description
*/
constructor(chronoUnit: ChronoTariffUnit, rate: number, name?: string);
/** Get the unit. */
get unit(): ChronoTariffUnit;
/** Get the rate. */
get rate(): number;
/** Get the optional name. */
get name(): string | undefined;
/**
* 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
* ```
*
* @param from - the starting date
* @param to - the ending date (exclusive)
* @param utc - if `true` then use UTC date components, otherwise assume the local time zone
* @returns the count of units between `from` and `to`, including any fractional component
*/
quantity(from: Date, to: Date, utc?: boolean): number;
}
//# sourceMappingURL=ChronoTariff.d.ts.map
1 change: 1 addition & 0 deletions lib/main/ChronoTariff.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

286 changes: 286 additions & 0 deletions lib/main/ChronoTariff.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/main/ChronoTariff.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/main/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @packageDocumentation
*/
export { ChronoField, ChronoFieldValue, ChronoFieldFormatter, } from "./ChronoFieldFormatter.js";
export { default as ChronoTariff, ChronoTariffUnit } from "./ChronoTariff.js";
export { default as Comparable } from "./Comparable.js";
export { default as IntRange, IntRangeFormatOptions, UNBOUNDED_RANGE, UNBOUNDED_VALUE, } from "./IntRange.js";
export { default as NumberFormatter, DEFAULT_FORMAT_OPTIONS, } from "./NumberFormatter.js";
Expand Down
Loading

0 comments on commit 961f518

Please sign in to comment.