patrimoniumjs
Version:
Patrimonium.js is a JavaScript library providing a set of tools to modelize the real estate operations of an individual and their impact on the financial situation of the same individual.
42 lines (41 loc) • 1.52 kB
TypeScript
/**
* Represents the options to create a date in a simple format, only counting
* the number of elapsed months since a given origin.
*/
export interface SimpleDateOptions {
/**
* The number of elapsed months since a given origin ('0' being used as the origin).
*/
nthMonth: number;
}
/**
* Represents a date in a simple format, only counting
* the number of elapsed months since a given origin.
*/
export declare class SimpleDate {
private options;
/**
* Returns an instance of `SimpleDate`.
* @param options The options of the `SimpleDate` to create.
*/
constructor(options?: SimpleDateOptions);
/**
* Returns the number of elapsed months since the origin.
*/
getMonths(): number;
/**
* Returns a new `SimpleDate` that adds the specified number of months
* to the value of this instance.
* @param months A number of months. The `months` parameter can be negative or positive.
*/
addMonths(months: number): SimpleDate;
/**
* Returns an array of `n` `SimpleDate` instances (`n` being equal to the `nthMonth` of this instance)
* where each `SimpleDate` instance has a `nthMonth` with a value starting from 0 to the `nthMonth - 1` of this instance.
*
* @example
* new SimpleDate({ nthMonth: 2 }).getDatesFromOrigin()
* // >> returns [new SimpleDate({ nthMonth: 0 }), new SimpleDate({ nthMonth: 1 })]
*/
getDatesFromOrigin(): SimpleDate[];
}