/** * ISO8601-like measure of a duration. Does not include * any concept of being relative to any specific date. */ export interface Duration { day?: number; hour?: number; minute?: number; month?: number; second?: number; week?: number; year?: number; } /** * A duration parsed from text, which includes the extracted * (serialized) duration text. */ export interface DurationWithText extends Duration { text: string; } /** * ISO-8601 designator for a duration value. */ export type DurationDesignator = "Y" | "M" | "W" | "D" | "T" | "H" | "S"; export declare const DURATION_DESIGNATORS: readonly DurationDesignator[]; export declare const DURATION_TIME_DESIGNATORS: readonly DurationDesignator[]; export declare const DURATION_DATE_DESIGNATORS: readonly DurationDesignator[]; /** * Map between {@link DurationDesignator} and {@link Duration} property name. * Does not include `M`, which is ambiguous, nor `T` which does not * correspond to a property. */ export declare const DURATION_KEY_BY_DESIGNATOR: Readonly<{ readonly Y: "year"; readonly D: "day"; readonly H: "hour"; readonly S: "second"; readonly W: "week"; }>; /** * Parse an ISO-8601 duration from the given text. If the text contains * extra non-duration characters after, will only throw an error if they * would produce an ambiguous result, or could indicate an incomplete * duration. * @throws {@link SyntaxError} * For text which is not a valid ISO-8601 duration. */ export declare const parseDuration: (text: string) => DurationWithText; /** * Lookup table for the conversion of a {@link Duration} property * value to seconds. Does not include `month` or `year`, which * have variable numbers of days. */ export declare const DURATION_KEY_SECONDS: Readonly>>; /** * Convert a given duration to an equivalent number of seconds. * @throws {@link RangeError} * If the duration contains `year` or `month`, which have variable * numbers of seconds, or if one of the duration properties has a * non-numeric value. */ export declare const secondsFromDuration: (duration: Partial) => number; export declare const formatDuration: (duration: Duration) => string; //# sourceMappingURL=duration.d.ts.map