-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdiff-ymd-package.d.ts
41 lines (36 loc) · 932 Bytes
/
diff-ymd-package.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
declare class DatesYMD {
constructor(
firstDate: string | number | Date,
secondDate: string | number | Date,
);
diffArray(): [number, number, number, string];
formattedYMD(): string;
customizeFormat(
yearUnit: string,
monthUnit: string,
dayUnit: string,
partSeparator: string,
): string;
diffInMonths(): number;
diffInWeeks(): number;
diffInDays(): number;
diffInYears(): number;
diffInHours(): number;
diffInMinutes(): number;
diffInSeconds(): number;
}
declare function diffDates(
firstDate: string | number | Date,
secondDate: string | number | Date,
): DatesYMD;
// Extend the global Date interface to add the `diff` method
declare global {
interface Date {
diff(secondDate: string | number | Date): DatesYMD;
}
}
// The hybrid CommonJS module export:
declare const diffYMDPackage: typeof DatesYMD & {
diffDates: typeof diffDates;
};
export = diffYMDPackage;