/** * Parses an ISO 8601 duration into a number of milliseconds. * * The grammar is `PnDTnHnMnS`, where days count as exactly 24 hours, a sign is allowed both on the whole * duration and on each component, and the seconds may carry up to nine fractional digits. Weeks, months and * years are rejected: they have no fixed length, and the API models them as calendar periods rather than as * durations. * * @param duration - The ISO 8601 duration to parse * @returns The duration in milliseconds * @throws {Error} If the input cannot be parsed as an ISO 8601 duration * * @example * parseDuration('PT1H') // 3600000 * parseDuration('P1DT2H30M') // 95400000 * parseDuration('PT0.5S') // 500 * parseDuration('-PT1H') // -3600000 */ export declare function parseDuration(duration: string): number; /** * Normalizes a duration into the ISO 8601 form the API expects on the wire. * * This is the duration counterpart of `normalizeDate`: it lets a duration input accept a plain number of * milliseconds, the way date inputs accept a timestamp. A string is assumed to be an ISO 8601 duration * already and is passed through untouched, because the endpoints do not all read the same grammar — some * take a time span (`PT1H`), others also accept a calendar period (`P1M`) — and rewriting the caller's value * could turn one the API accepts into one it rejects. * * @param duration - The duration to normalize, either a number of milliseconds or an ISO 8601 duration * @returns The duration as an ISO 8601 string, or undefined if input is null/undefined * @throws {Error} If the input is a number that cannot be turned into a duration * * @example * normalizeDuration(3600000) // 'PT1H' * normalizeDuration(90500) // 'PT1M30.5S' * normalizeDuration(0) // 'PT0S' * normalizeDuration('P1M') // 'P1M' */ export declare function normalizeDuration(duration: number | string | null | undefined): string | undefined; //# sourceMappingURL=duration-utils.d.ts.map