UNPKG

@technobuddha/library

Version:
96 lines (95 loc) 2.35 kB
/** * Store and manipulate a duration of time */ export declare class TimeSpan { /** * * @param text formatted timespan (dd:hh:mm:ss.fff) leading zero fields can be omitted * @param ticks the number of ticks (milliseconds) * @param d Days * @param h Hours * @param m minutes * @param s seconds * @param ms milliseconds */ constructor(); constructor(ticks: number); constructor(h: number, m: number, s: number); constructor(d: number, h: number, m: number, s: number); constructor(d: number, h: number, m: number, s: number, ms: number); constructor(text: string); private readonly clicks; /** * Get the days portion */ get days(): number; /** * Get the hours portion */ get hours(): number; /** * Get the minutes portion */ get minutes(): number; /** * Get the seconds portion */ get seconds(): number; /** * Get the milliseconds portion */ get milliseconds(): number; /** * Get the total number of ticks (milliseconds) */ get ticks(): number; /** * Get the total number of days */ get totalDays(): number; /** * Get the total number of hours */ get totalHours(): number; /** * Get the total number of minutes */ get totalMinutes(): number; /** * Get the total number of seconds */ get totalSeconds(): number; /** * Get the total number of milliseconds */ get totalMilliseconds(): number; /** * Format the timespan using a mask * * @param mask The mask * @returns the formatted TimeSpan */ format(mask?: string): string; /** * Convert the TimeSpan to a string * * @returns formatted string */ toString(): string; /** * Add two timespans * * @param other TimeSpan to add to this * @returns a TimeSpan that is the sum of two timespans */ add(other: TimeSpan): TimeSpan; /** * Compare two TimeSpans * * @param t1 First TimeSpan * @param t2 Second TimeSpan * @returns -1 if the first time span is less then the second, 0 if they are equal, 1 if the first is greater */ static compare(t1: TimeSpan, t2: TimeSpan): number; } export default TimeSpan;