@rr0/time
Version:
EDTF parsing
103 lines • 4.37 kB
text/typescript
/** @import { EDTFParser } from "../../EDTFParser.mjs" */
/** @import { LevelFactory } from "../../LevelFactory.mjs" */
/** @import { Level2Date } from "../date/Level2Date.mjs" */
/** @import { Level2Year } from "../year/Level2Year.mjs" */
/** @import { Level2Month } from "../month/Level2Month.mjs" */
/** @import { Level2Day } from "../day/Level2Day.mjs" */
/** @import { Level2Hour } from "../hour/Level2Hour.mjs" */
/** @import { Level2Minute } from "../minute/Level2Minute.mjs" */
/** @import { Level2Second } from "../second/Level2Second.mjs" */
/**
* @typedef {Object} Level2DurationInSpec
* @property {Level2Year|number} [years]
* @property {Level2Month|number} [months]
* @property {Level2Day|number} [days]
* @property {Level2Hour|number} [hours]
* @property {Level2Minute|number} [minutes]
* @property {Level2Second|number} [seconds]
* @property {Level2Millisecond|number} [milliseconds]
*/
/**
* @typedef {Object} Level2DurationOutSpec
* @property {Level2Year} [years]
* @property {Level2Month} [months]
* @property {Level2Day} [days]
* @property {Level2Hour} [hours]
* @property {Level2Minute} [minutes]
* @property {Level2Second} [seconds]
* @property {Level2Millisecond} [milliseconds]
*/
/**
* @template {Level2Year} [Y=Level2Year]
* @template {Level2Month} [M=Level2Month]
* @template {Level2Day} [D=Level2Day]
* @template {Level2Hour} [H=Level2Hour]
* @template {Level2Minute} [M=Level2Minute]
* @template {Level2Second} [S=Level2Second]
* @template {Level2Millisecond} [C=Level2Millisecond]
* @extends Level1Duration
*/
export class Level2Duration<Y extends Level2Year = Level2Year, M extends Level2Month = Level2Month, D extends Level2Day = Level2Day, H extends Level2Hour = Level2Hour, S extends Level2Second = Level2Second, C extends Level2Millisecond = Level2Millisecond> extends Level1Duration<import("../../index.mjs").Level1Year, import("../../index.mjs").Level1Month, import("../../index.mjs").Level1Day, import("../../index.mjs").Level1Hour, import("../../index.mjs").Level1Second, Level1Millisecond> {
/**
* @param {Level2DurationInSpec} spec
* @return {number}
*/
static valueFromSpec(spec: Level2DurationInSpec): number;
/**
* @template D=Level2Duration
* @template O=Level2DurationOutSpec
* @param {D} comp
* @param {LevelFactory} [factory]
* @return {O}
*/
static toSpec<D_1, O>(comp: D_1, factory?: LevelFactory<any, any, any, any, any, any, any>): O;
/**
* @param {string} str The duration string to parse.
* @param {EDTFParser} [parser] The parser to use.
* @return {Level2Duration}
*/
static fromString(str: string, parser?: EDTFParser<any>): Level2Duration;
/**
* @param {Level2Date} beforeDate
* @param {Level2Date} afterDate
* @return {Level2Duration}
*/
static between(beforeDate: Level2Date, afterDate: Level2Date): Level2Duration;
/**
* @param {Level2DurationInSpec|number} spec The duration spec in years, months, etc., or value in milliseconds.
*/
constructor(spec: Level2DurationInSpec | number);
/**
* @return {Level2DurationOutSpec}
*/
toSpec(): Level2DurationOutSpec;
}
export type Level2DurationInSpec = {
years?: Level2Year | number;
months?: Level2Month | number;
days?: Level2Day | number;
hours?: Level2Hour | number;
minutes?: Level2Minute | number;
seconds?: Level2Second | number;
milliseconds?: Level2Millisecond | number;
};
export type Level2DurationOutSpec = {
years?: Level2Year;
months?: Level2Month;
days?: Level2Day;
hours?: Level2Hour;
minutes?: Level2Minute;
seconds?: Level2Second;
milliseconds?: Level2Millisecond;
};
import type { Level2Year } from "../year/Level2Year.mjs";
import type { Level2Month } from "../month/Level2Month.mjs";
import type { Level2Day } from "../day/Level2Day.mjs";
import type { Level2Hour } from "../hour/Level2Hour.mjs";
import type { Level2Second } from "../second/Level2Second.mjs";
import { Level1Duration } from "../../level1/duration/Level1Duration.mjs";
import type { LevelFactory } from "../../LevelFactory.mjs";
import { EDTFParser } from "../../EDTFParser.mjs";
import type { Level2Date } from "../date/Level2Date.mjs";
import type { Level2Minute } from "../minute/Level2Minute.mjs";
//# sourceMappingURL=Level2Duration.d.mts.map