-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
178 lines (137 loc) · 9.13 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import { F } from 'ts-toolbelt';
export interface LocaleOptions {
daysShort: Array<string>,
daysLong: Array<string>,
monthsShort: Array<string>
monthsLong: Array<string>
ordinals: {
[key: number]: string;
default: string;
},
periods: Array<string>
utc: string;
delimiter: string;
}
export type Increment =
'l' | // millisecond
's' | // second
't' | // minute
'h' | // hour
'd' | // day
'w' | // week
'm' | // month (position will be on the same date and time of the month)
'y'; // year (position will be on the same date and time of the year)
export type SetIncrement =
'l' | // millisecond
's' | // second
't' | // minute
'h' | // hour
'd' | // day of the month (1-indexed)
'e' | // day of the week (1-indexed)
'w' | // week of the year (1-indexed)
'm' | // month (1-indexed; position will be on the same date and time of the month)
'y'; // year (position will be on the date and time of the year)
export type GetIncrement =
'z' | // the time zone offset in hours, always returns 0 when used with getUTC()
'l' | // the millisecond
's' | // the second
't' | // the minute
'h' | // the hour
'd' | // the day of the month (1-indexed)
'e' | // the day of the week (1-indexed)
'w' | // the week of the year (1-indexed)
'm' | // the month (1-indexed)
'y'; // the year
export type IncrementDict = { [key in Increment]: number };
export type SetIncrementDict = { [key in SetIncrement]: number };
export type GetIncrementArray = Array<GetIncrement>;
export function reform(format: string, date: Date): string;
export function reform(format: string): F.Curry<(date: Date) => string>;
export function reformWithOverrides(overrides: Partial<LocaleOptions>, format: string, date: Date): string;
export function reformWithOverrides(overrides: Partial<LocaleOptions>, format: string): (date: Date) => string;
export function reformWithOverrides(overrides: Partial<LocaleOptions>): F.Curry<(format: string, date: Date) => string>;
export function reformWithLocale(locale: LocaleOptions, format: string, date: Date): string;
export function reformWithLocale(locale: LocaleOptions, format: string): (date: Date) => string;
export function reformWithLocale(locale: LocaleOptions): F.Curry<(format: string, date: Date) => string>;
export function isDate(value: unknown): value is Date;
export function isLeapYear(date: Date): boolean;
export function isLeapYearUTC(date: Date): boolean;
export function parse(input: string | Date): Date;
export function parseUTC(input: string | Date): Date;
export function add(increment: Increment, n: number, date: Date): Date;
export function add(increment: Increment, n: number): (date: Date) => Date;
export function add(increment: Increment): F.Curry<(n: number, date: Date) => Date>;
export function add(increment: Increment, n: number, fn: Function): Date;
export function add(increment: Increment, n: number): (fn: Function) => Date;
export function add(increment: Increment): F.Curry<(n: number, fn: Function) => Date>;
export function addFor(dict: Partial<IncrementDict>, n: number, date: Date): Date;
export function addFor(dict: Partial<IncrementDict>, n: number): (date: Date) => Date;
export function addFor(dict: Partial<IncrementDict>): F.Curry<(n: number, date: Date) => Date>;
export function addFor(dict: Partial<IncrementDict>, n: number, fn: Function): Date;
export function addFor(dict: Partial<IncrementDict>, n: number): (fn: Function) => Date;
export function addFor(dict: Partial<IncrementDict>): F.Curry<(n: number, fn: Function) => Date>;
export function subtract(increment: Increment, n: number, date: Date): Date;
export function subtract(increment: Increment, n: number): (date: Date) => Date;
export function subtract(increment: Increment): F.Curry<(n: number, date: Date) => Date>;
export function subtract(increment: Increment, n: number, fn: Function): Date;
export function subtract(increment: Increment, n: number): (fn: Function) => Date;
export function subtract(increment: Increment): F.Curry<(n: number, fn: Function) => Date>;
export function subtractFor(dict: Partial<IncrementDict>, n: number, date: Date): Date;
export function subtractFor(dict: Partial<IncrementDict>, n: number): (date: Date) => Date;
export function subtractFor(dict: Partial<IncrementDict>): F.Curry<(n: number, date: Date) => Date>;
export function subtractFor(dict: Partial<IncrementDict>, n: number, fn: Function): Date;
export function subtractFor(dict: Partial<IncrementDict>, n: number): (fn: Function) => Date;
export function subtractFor(dict: Partial<IncrementDict>): F.Curry<(n: number, fn: Function) => Date>;
export function startOf(increment: Exclude<SetIncrement, 'l'>, date: Date): Date;
export function startOf(increment: Exclude<SetIncrement, 'l'>): F.Curry<(date: Date) => Date>;
export function startOf(increment: Exclude<SetIncrement, 'l'>, fn: Function): Date;
export function startOf(increment: Exclude<SetIncrement, 'l'>): F.Curry<(fn: Function) => Date>;
export function startOfUTC(increment: Exclude<SetIncrement, 'l'>): (date: Date) => Date;
export function startOfUTC(increment: Exclude<SetIncrement, 'l'>, date: Date): Date;
export function startOfUTC(increment: Exclude<SetIncrement, 'l'>, fn: Function): Date;
export function startOfUTC(increment: Exclude<SetIncrement, 'l'>): F.Curry<(fn: Function) => Date>;
export function endOf(increment: Exclude<SetIncrement, 'l'>, date: Date): Date;
export function endOf(increment: Exclude<SetIncrement, 'l'>): F.Curry<(date: Date) => Date>;
export function endOf(increment: Exclude<SetIncrement, 'l'>, fn: Function): Date;
export function endOf(increment: Exclude<SetIncrement, 'l'>): F.Curry<(fn: Function) => Date>;
export function endOfUTC(increment: Exclude<SetIncrement, 'l'>, date: Date): Date;
export function endOfUTC(increment: Exclude<SetIncrement, 'l'>): F.Curry<(date: Date) => Date>;
export function endOfUTC(increment: Exclude<SetIncrement, 'l'>, fn: Function): Date;
export function endOfUTC(increment: Exclude<SetIncrement, 'l'>): F.Curry<(fn: Function) => Date>;
export function set(increment: SetIncrement, value: number, date: Date): Date;
export function set(increment: SetIncrement, value: number): (date: Date) => Date;
export function set(increment: SetIncrement): F.Curry<(value: number, date: Date) => Date>;
export function set(increment: SetIncrement, value: number, fn: Function): Date;
export function set(increment: SetIncrement, value: number): (fn: Function) => Date;
export function set(increment: SetIncrement): F.Curry<(value: number, fn: Function) => Date>;
export function setUTC(increment: SetIncrement, value: number, date: Date): Date;
export function setUTC(increment: SetIncrement, value: number): (date: Date) => Date;
export function setUTC(increment: SetIncrement): F.Curry<(value: number, date: Date) => Date>;
export function setUTC(increment: SetIncrement, value: number, fn: Function): Date;
export function setUTC(increment: SetIncrement, value: number): (fn: Function) => Date;
export function setUTC(increment: SetIncrement): F.Curry<(value: number, fn: Function) => Date>;
export function setFor(dict: Partial<SetIncrementDict>, value: number, date: Date): Date;
export function setFor(dict: Partial<SetIncrementDict>, value: number): (date: Date) => Date;
export function setFor(dict: Partial<SetIncrementDict>): F.Curry<(value: number, date: Date) => Date>;
export function setFor(dict: Partial<SetIncrementDict>, value: number, fn: Function): Date;
export function setFor(dict: Partial<SetIncrementDict>, value: number): (fn: Function) => Date;
export function setFor(dict: Partial<SetIncrementDict>): F.Curry<(value: number, fn: Function) => Date>;
export function setUTCFor(dict: Partial<SetIncrementDict>, value: number, date: Date): Date;
export function setUTCFor(dict: Partial<SetIncrementDict>, value: number): (date: Date) => Date;
export function setUTCFor(dict: Partial<SetIncrementDict>): F.Curry<(value: number, date: Date) => Date>;
export function setUTCFor(dict: Partial<SetIncrementDict>, value: number, fn: Function): Date;
export function setUTCFor(dict: Partial<SetIncrementDict>, value: number): (fn: Function) => Date;
export function setUTCFor(dict: Partial<SetIncrementDict>): F.Curry<(value: number, fn: Function) => Date>;
export function get(increment: GetIncrement, date: Date): number;
export function get(increment: GetIncrement): F.Curry<(date: Date) => number>;
export function getUTC(increment: GetIncrement, date: Date): number;
export function getUTC(increment: GetIncrement): F.Curry<(date: Date) => number>;
export function getFor(arr: GetIncrementArray, date: Date): Array<number>;
export function getFor(arr: GetIncrementArray): F.Curry<(date: Date) => Array<number>>;
export function getUTCFor(arr: GetIncrementArray, date: Date): Array<number>;
export function getUTCFor(arr: GetIncrementArray): F.Curry<(date: Date) => Array<number>>;
export function diff(increment: Increment, date1: Date, date2: Date): number;
export function diff(increment: Increment, date1: Date): (date2: Date) => number;
export function diff(increment: Increment): F.Curry<(date1: Date, date2: Date) => number>;
export function compare(date1: Date, date2: Date): -1 | 0 | 1;
export function compare(date1: Date): F.Curry<(date2: Date) => -1 | 0 | 1>;