forked from Lakerfield/TypeScript.Definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoment.d.ts
148 lines (106 loc) · 3.02 KB
/
moment.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// moment.d.ts by Michael Lakerveld
// Source: http://momentjs.com/docs/
// TODO customize http://momentjs.com/docs/#/customization/
// TODO plugins http://momentjs.com/docs/#/plugins/
// TODO lang definition http://momentjs.com/docs/#/i18n/
interface MomentInput {
years?: number;
y?: number;
months?: number;
M?: number;
weeks?: number;
w?: number;
days?: number;
d?: number;
hours?: number;
h?: number;
minutes?: number;
m?: number;
seconds?: number;
s?: number;
milliseconds?: number;
ms?: number;
}
interface Duration {
humanize(): string;
milliseconds(): number;
asMilliseconds(): number;
seconds(): number;
asSeconds(): number;
minutes(): number;
asMinutes(): number;
hours(): number;
asHours(): number;
days(): number;
asDays(): number;
months(): number;
asMonths(): number;
years(): number;
asYears(): number;
}
interface Moment {
format(format: string): string;
format(): string;
fromNow(): string;
startOf(soort: string): Moment;
endOf(soort: string): Moment;
add(input: MomentInput): Moment;
add(soort: string, aantal: number): Moment;
substract(input: MomentInput): Moment;
substract(soort: string, aantal: number): Moment;
calendar(): string;
valueOf(): string;
local(): Moment; // current date/time in local mode
utc(): Moment; // current date/time in UTC mode
isValid(): bool;
year(y: number): Moment;
month(M: number): Moment;
day(d: number): Moment;
date(d: number): Moment;
hours(h: number): Moment;
minutes(m: number): Moment;
seconds(s: number): Moment;
milliseconds(ms: number): Moment;
sod(): Moment; // Start of Day
eod(): Moment; // End of Day
from(f: Moment): string;
from(f: Moment, suffix: bool): string;
from(d: Date): string;
from(s: string): string;
diff(b: Moment): number;
diff(b: Moment, soort: string): number;
diff(b: Moment, soort: string, round: bool): number;
toDate(): Date;
unix(): number;
isLeapYear(): bool;
zone(): number;
daysInMonth(): number;
isDST(): bool;
lang(language: string);
lang(reset: bool);
lang(): string;
}
/*
Static members of moment
*/
interface MomentStatic {
(): Moment;
(date: string): Moment;
(date: string, time: string): Moment;
(date: Date): Moment;
(clone: Moment): Moment;
clone(): Moment;
unix(timestamp: number): Moment;
utc(): Moment; // current date/time in UTC mode
utc(Number: number): Moment; // milliseconds since the Unix Epoch in UTC mode
utc(array: number[]): Moment; // parse an array of numbers matching Date.UTC() parameters
utc(String: string): Moment; // parse string into UTC mode
utc(String1: string, String2: string): Moment; // parse a string and format into UTC mode
isMoment(m: any): bool;
lang(language: string);
lang(language: string, definition: any); // TODO definition
duration(milliseconds: Number): Duration;
duration(num: Number, soort: string): Duration;
duration(input: MomentInput): Duration;
}
declare var moment: MomentStatic;