import { TemporalInterface, TemporalUnitType } from '@interstellar-tools/types'; /** * Seconds-per-unit lookup for all canonical {@link TemporalUnitType} symbols. * * ### Conventions * - **Base**: conversions are performed via **seconds**. * - **SI day**: `d = 86 400 s` (from {@link SECONDS_PER_DAY}). * - **Julian year**: `yr = 365.25 d = 31 557 600 s` * (from {@link JULIAN_YEAR_SECONDS}); `kyr/Myr/Gyr` are powers of 10 thereof. * - Units are **canonical** and **case-sensitive** (e.g., `'μs'` uses the Unicode micro sign). * * $$ * \text{seconds}(u) \;=\; \text{value}\times \mathrm{SECONDS\_PER}[u] * $$ * * @example * ```ts * // seconds per hour: * SECONDS_PER.h; // 3600 * * // seconds in a Julian year: * SECONDS_PER.yr; // 31_557_600 * ``` * @hidden */ export declare const SECONDS_PER: Record; /** * Convert a temporal **duration** between any two canonical {@link TemporalUnitType} units. * * - Uses {@link SECONDS_PER} with **seconds** as the intermediate unit. * - Interprets `d` as the **SI day** and `yr/kyr/Myr/Gyr` via the **Julian year** convention. * - The `time.unit` is expected to be **canonical**; if you accept aliases upstream, * normalize them before calling (e.g., with `normalizeTemporalUnit`). * - The `targetUnit` is normalized to a canonical symbol (idempotent for canonical input). * * $$ * \text{value}_{\text{target}} * \;=\; * \frac{\text{value}_{\text{in}} \cdot \mathrm{SECONDS\_PER}[u_{\text{in}}]} * {\mathrm{SECONDS\_PER}[u_{\text{out}}]} * $$ * * @param time Input duration `{ value, unit }` in canonical units. * @param targetUnit Desired canonical output unit (will be normalized). * @returns A new `{ value, unit }` where `unit` is the canonical target symbol. * * @example * ```ts * convertTemporalUnit({ value: 2, unit: 'h' }, 'min'); * // → { value: 120, unit: 'min' } * * convertTemporalUnit({ value: 1, unit: 'd' }, 's'); * // → { value: 86_400, unit: 's' } * * convertTemporalUnit({ value: 3, unit: 'Myr' }, 'kyr'); * // → { value: 3000, unit: 'kyr' } * * convertTemporalUnit({ value: 1, unit: 'yr' }, 'd'); * // → { value: 365.25, unit: 'd' } * ``` * * @see SECONDS_PER_DAY * @see JULIAN_YEAR_SECONDS * @see normalizeTemporalUnit */ export declare const convertTemporalUnit: (time: TemporalInterface, targetUnit: TemporalUnitType) => TemporalInterface; //# sourceMappingURL=convert-temporal-unit.d.ts.map