mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-22 15:02:23 +00:00
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
// From: https://github.com/icholy/Duration.js/pull/15
|
|
// Once the above is merged, use the inbuilt module types
|
|
declare module 'duration-js' {
|
|
type DurationLike = Duration | string | number;
|
|
type DateLike = Date | number;
|
|
|
|
class Duration {
|
|
private _milliseconds: number;
|
|
|
|
constructor(value?: DurationLike);
|
|
|
|
static millisecond: Duration;
|
|
static second: Duration;
|
|
static minute: Duration;
|
|
static hour: Duration;
|
|
static day: Duration;
|
|
static week: Duration;
|
|
|
|
static milliseconds(milliseconds: number): Duration;
|
|
static seconds(seconds: number): Duration;
|
|
static minutes(minutes: number): Duration;
|
|
static hours(hours: number): Duration;
|
|
static days(days: number): Duration;
|
|
static weeks(weeks: number): Duration;
|
|
|
|
nanoseconds(): number;
|
|
microseconds(): number;
|
|
milliseconds(): number;
|
|
seconds(): number;
|
|
minutes(): number;
|
|
hours(): number;
|
|
days(): number;
|
|
weeks(): number;
|
|
|
|
toString(): string;
|
|
valueOf(): number;
|
|
|
|
isGreaterThan(duration: DurationLike): boolean;
|
|
isLessThan(duration: DurationLike): boolean;
|
|
isEqualTo(duration: DurationLike): boolean;
|
|
|
|
roundTo(duration: DurationLike): void;
|
|
|
|
after(date: DateLike): Date;
|
|
|
|
static since(date: DateLike): Duration;
|
|
static until(date: DateLike): Duration;
|
|
static between(a: DateLike, b: DateLike): Duration;
|
|
static parse(duration: string): Duration;
|
|
static fromMicroseconds(us: number): Duration;
|
|
static fromNanoseconds(ns: number): Duration;
|
|
|
|
static add(a: Duration, b: Duration): Duration;
|
|
static subtract(a: Duration, b: Duration): Duration;
|
|
static multiply(a: Duration, b: number): Duration;
|
|
static multiply(a: number, b: Duration): Duration;
|
|
static divide(a: Duration, b: Duration): number;
|
|
static abs(d: DurationLike): Duration;
|
|
}
|
|
export = Duration;
|
|
}
|