UNPKG

minotor

Version:

A lightweight client-side transit routing library.

52 lines (51 loc) 1.78 kB
export declare class Duration { private totalSeconds; private constructor(); /** * Creates a Duration instance from a given number of seconds. * * @param seconds - The number of seconds for the duration. * @returns A Duration instance representing the specified duration. */ static fromSeconds(seconds: number): Duration; /** * Creates a Duration instance from a given number of minutes. * * @param minutes - The number of minutes for the duration. * @returns A Duration instance representing the specified duration. */ static fromMinutes(minutes: number): Duration; /** * Gets a Duration instance representing zero duration (0 hours, 0 minutes, 0 seconds). * * @returns A Duration instance representing zero duration. */ static zero(): Duration; /** * Converts the duration instance to a string in "HH:MM:SS" format. * * @returns A string representing the duration. */ toString(): string; /** * Gets the duration as the number of seconds. * * @returns The duration in seconds. */ toSeconds(): number; /** * Adds another Duration to this instance and returns the result as a new Duration. * * @param other - The other Duration to add. * @returns A new Duration instance representing the sum. */ add(other: Duration): Duration; /** * Subtracts another Duration from this instance and returns the result as a new Duration. * If the result would be negative, it returns a Duration of 0 seconds. * * @param other - The other Duration to subtract. * @returns A new Duration instance representing the difference. */ subtract(other: Duration): Duration; }