@openfisca/json-model
Version:
Library to handle informations extracted in JSON or YAML format from OpenFisca parameters, variables, etc
36 lines (35 loc) • 1.26 kB
TypeScript
export declare class Instant {
readonly year: number;
readonly month: number;
readonly day: number;
constructor(year: number, month?: number, day?: number);
get date(): Date;
static fromString(value: string): Instant;
offset(offset: "first-of" | "last-of" | number, unit: PeriodUnit): Instant;
period(unit: PeriodUnit, size?: number): Period;
toString(): string;
}
export declare class Period {
readonly unit: PeriodUnit;
readonly start: Instant;
readonly size: number;
constructor(unit: PeriodUnit, start: Instant, size?: number);
get days(): number;
get first_day(): Period;
get first_month(): Period;
static fromString(value: string): Period;
get last_3_months(): Period;
get last_month(): Period;
get last_year(): Period;
get n_2(): Period;
offset(offset: "first-of" | "last-of" | number, unit?: PeriodUnit): Period;
get stop(): Instant;
get this_year(): Period;
toString(): string;
}
export type PeriodUnit = "day" | "eternity" | "month" | "year";
export declare const dateRegExp: RegExp;
export declare const instantRegExp: RegExp;
export declare function sortValueByInstantDescending<T>(valueByInstant: {
[instant: string]: T;
}): [string, T][];