forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timezone-js.d.ts
93 lines (83 loc) · 3.09 KB
/
timezone-js.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Type definitions for timezone-js
// Project: https://github.com/mde/timezone-js
// Definitions by: bonnici <https://github.com/bonnici>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/timezone-js.d.ts
declare module "timezone-js" {
export var timezone: TimezoneJs;
export class Date {
constructor(timezone?: string);
// Note due to naming conflict I have not found a way to introduce the constructor
// that takes a regular Date object. Instead, I defined it to take an Object.
constructor(date: Object, timezone?: string);
constructor(utcMillis: number, timezone?: string);
constructor(time: string, timezone?: string);
constructor(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number, timezone?: string);
setTimezone: (timezone: string) => void;
// regular Date members
toString(): string;
toDateString(): string;
toTimeString(): string;
toLocaleString(): string;
toLocaleDateString(): string;
toLocaleTimeString(): string;
valueOf(): number;
getTime(): number;
getFullYear(): number;
getUTCFullYear(): number;
getMonth(): number;
getUTCMonth(): number;
getDate(): number;
getUTCDate(): number;
getDay(): number;
getUTCDay(): number;
getHours(): number;
getUTCHours(): number;
getMinutes(): number;
getUTCMinutes(): number;
getSeconds(): number;
getUTCSeconds(): number;
getMilliseconds(): number;
getUTCMilliseconds(): number;
getTimezoneOffset(): number;
setTime(time: number): number;
// Note the setters have a non-void return type. Date has them as well, according to TypeScript
setMilliseconds(ms: number): number;
setUTCMilliseconds(ms: number): number;
setSeconds(sec: number, ms?: number): number;
setUTCSeconds(sec: number, ms?: number): number;
setMinutes(min: number, sec?: number, ms?: number): number;
setUTCMinutes(min: number, sec?: number, ms?: number): number;
setHours(hours: number, min?: number, sec?: number, ms?: number): number;
setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;
setDate(date: number): number;
setUTCDate(date: number): number;
setMonth(month: number, date?: number): number;
setUTCMonth(month: number, date?: number): number;
setFullYear(year: number, month?: number, date?: number): number;
setUTCFullYear(year: number, month?: number, date?: number): number;
toUTCString(): string;
toISOString(): string;
toJSON(key?: any): string;
}
export interface TimezoneJs {
zoneFileBasePath: string;
loadingScheme: number;
loadingSchemes: TimezoneJsLoadingSchemes;
transport(opts: TimezoneJsOptions): any;
init(opts?: TimezoneJsOptions): any;
getAllZones(): string[];
loadZoneDataFromObject(obj: Object): void;
}
export interface TimezoneJsOptions {
async?: boolean;
success?: (data: string) => void;
error?: (err: Error) => void;
url?: string;
}
export class TimezoneJsLoadingSchemes {
PRELOAD_ALL: number;
LAZY_LOAD: number;
MANUAL_LOAD: number;
}
}