-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
54 lines (52 loc) · 1.35 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* Freeze point in time.
* @param args Same arguments as the `Date` constructor.
*/
export function freeze(...args: any[]): Date;
/**
* Defrost a frozen point in time.
* Used in combination with travelling will start ticking the clock.
*/
export function defrost(): void;
/**
* Time travel to another era.
* @param args Same arguments as Date constructor.
*/
export function travel(...args: any[]): Date;
/**
* Resets Date to current glory.
*/
export function reset(): void;
/**
* Utility function to see if we still travel or freeze time.
*/
export function isKeepingTime(): boolean;
/**
* Timezone traveling
*/
export class TimeZoneTraveller {
/**
*
* @param timeZone IANA time zone
*/
constructor(timeZone: string);
/** IANA time zone */
readonly timeZone: string;
defrost: typeof defrost;
reset: typeof reset;
isKeepingTime: typeof isKeepingTime;
freeze: typeof freeze;
travel: typeof travel;
/**
* Get timezone datetime in milliseconds, like Date.getTime
* @param args Same arguments as Date constructor.
* @returns number of milliseconds since the epoch (January 1, 1970, UTC)
*/
getTime(...args: any[]): number;
}
/**
* Travel to time zone.
* @param timeZone IANA time zone
* @param args Optional travel to date arguments
*/
export function timezone(timeZone: string, ...args: any[]): TimeZoneTraveller;