@rr0/time
Version:
EDTF parsing
120 lines • 4.83 kB
text/typescript
/** @import { Level0Date } from "../date/Level0Date.mjs" */
/** @import { EDTFParser } from "../../EDTFParser.mjs" */
/** @import { LevelFactory } from "../../LevelFactory.mjs" */
/** @import { Level1Date } from "../date/Level1Date.mjs" */
/** @import { Level1Year } from "../year/Level1Year.mjs" */
/** @import { Level1Month } from "../month/Level1Month.mjs" */
/** @import { Level1Day } from "../day/Level1Day.mjs" */
/** @import { Level1Hour } from "../hour/Level1Hour.mjs" */
/** @import { Level1Minute } from "../minute/Level1Minute.mjs" */
/** @import { Level1Second } from "../second/Level1Second.mjs" */
/**
* @typedef {Object} Level1DurationInSpec
* @property {Level1Year|number} [years]
* @property {Level1Month|number} [months]
* @property {Level1Day|number} [days]
* @property {Level1Hour|number} [hours]
* @property {Level1Minute|number} [minutes]
* @property {Level1Second|number} [seconds]
* @property {Level1Millisecond|number} [milliseconds]
* @property {boolean} [uncertain]
* @property {boolean} [approximate]
*/
/**
* @typedef {Object} Level1DurationOutSpec
* @property {Level1Year} [years]
* @property {Level1Month} [months]
* @property {Level1Day} [days]
* @property {Level1Hour} [hours]
* @property {Level1Minute} [minutes]
* @property {Level1Second} [seconds]
* @property {Level1Millisecond} [milliseconds]
* @property {boolean} [uncertain]
* @property {boolean} [approximate]
*/
/**
* @template {Level1Year} [Y = Level1Year]
* @template {Level1Month} [M = Level1Month]
* @template {Level1Day} [D = Level1Day]
* @template {Level1Hour} [H = Level1Hour]
* @template {Level1Minute} [M = Level1Minute]
* @template {Level1Second} [S = Level1Second]
* @template {Level1Millisecond} [C = Level1Millisecond]
*/
export class Level1Duration<Y extends Level1Year = Level1Year, M extends Level1Month = Level1Month, D extends Level1Day = Level1Day, H extends Level1Hour = Level1Hour, S extends Level1Second = Level1Second, C extends Level1Millisecond = Level1Millisecond> extends Level1Component {
/**
* @protected
* @param spec
* @param {string} durCompName
* @return {boolean}
*/
protected static getBoolean(spec: any, durCompName: string): boolean;
/**
* @protected
* @param spec The object containing group values.
* @param {string} durCompGroupName The regex duration component group name (for year, month, etc.) as singular.
* @return {number}
*/
protected static getValue(spec: any, durCompGroupName: string): number;
/**
* @param {Level1Duration} comp
* @param {LevelFactory} [factory]
* @return {Level1DurationOutSpec}
*/
static toSpec(comp: Level1Duration, factory?: LevelFactory<any, any, any, any, any, any, any>): Level1DurationOutSpec;
/**
* @param {string} str The duration string to parse.
* @param {EDTFParser} [parser]
* @return {Level1Duration}
*/
static fromString(str: string, parser?: EDTFParser<any>): Level1Duration;
/**
* @param {Level1Date} beforeDate
* @param {Level1Date} afterDate
* @return {Level1Duration}
*/
static between(beforeDate: Level1Date, afterDate: Level1Date): Level1Duration;
/**
* @param {Level1DurationInSpec|number} spec
*/
constructor(spec: Level1DurationInSpec | number);
toString(renderer?: Level1DurationRenderer): string;
/**
* @return {Level1DurationOutSpec}
*/
toSpec(): Level1DurationOutSpec;
}
export type Level1DurationInSpec = {
years?: Level1Year | number;
months?: Level1Month | number;
days?: Level1Day | number;
hours?: Level1Hour | number;
minutes?: Level1Minute | number;
seconds?: Level1Second | number;
milliseconds?: Level1Millisecond | number;
uncertain?: boolean;
approximate?: boolean;
};
export type Level1DurationOutSpec = {
years?: Level1Year;
months?: Level1Month;
days?: Level1Day;
hours?: Level1Hour;
minutes?: Level1Minute;
seconds?: Level1Second;
milliseconds?: Level1Millisecond;
uncertain?: boolean;
approximate?: boolean;
};
import type { Level1Year } from "../year/Level1Year.mjs";
import type { Level1Month } from "../month/Level1Month.mjs";
import type { Level1Day } from "../day/Level1Day.mjs";
import type { Level1Hour } from "../hour/Level1Hour.mjs";
import type { Level1Second } from "../second/Level1Second.mjs";
import { Level1Component } from "../component/Level1Component.mjs";
import { Level1DurationRenderer } from "./Level1DurationRenderer.mjs";
import type { LevelFactory } from "../../LevelFactory.mjs";
import type { EDTFParser } from "../../EDTFParser.mjs";
import type { Level1Date } from "../date/Level1Date.mjs";
import type { Level1Minute } from "../minute/Level1Minute.mjs";
//# sourceMappingURL=Level1Duration.d.mts.map