forked from jbaroudi/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
moment-range.d.ts
59 lines (36 loc) · 1.39 KB
/
moment-range.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
// Type definitions for Moment.js 2.0.3
// Project: https://github.com/gf3/moment-range
// Definitions by: Bart van den Burg <https://github.com/Burgov>, Wilgert Velinga <https://github.com/wilgert>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../moment/moment.d.ts" />
declare module moment {
interface Moment {
within (x: Range): boolean;
}
interface MomentStatic {
range(range: string): Range;
range(range: Date[]): Range;
range(range: Moment[]): Range;
range(start: Date, end: Date): Range;
range(start: Moment, end: Moment): Range;
}
interface Range {
start: Moment;
end: Moment;
contains (other: Date, exclusive?: boolean): boolean;
contains (other: Moment, exclusive?: boolean): boolean;
overlaps (range: Range): boolean;
intersect (other: Range): Range;
add (other: Range): Range;
subtract (other: Range): Range[];
by (range: string, hollaback: (current: Moment) => void, exclusive?: boolean): void;
by (range: Range, hollaback: (current: Moment) => void, exclusive?: boolean): void;
isSame (other: Range): boolean;
diff (unit?: string): number;
toDate (): Date;
toString (): string;
valueOf (): number;
center (): number;
clone (): Range;
}
}