-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparttime.d.ts
122 lines (122 loc) · 4.19 KB
/
parttime.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
/** Creates a "PartTime" instance that represents a single moment in time with placeholder that is useful for compareing repeating moment. Currently, PartTime objects does not support timezones. */
declare class PartTime implements PartTime.TimeProps, PartTime.DateLike {
/**
* make a parttime
* ```typescript
* new PartTime()
* new PartTime("*-10-12")
* new PartTime("1970-1-1")
* new PartTime("1970-1-1T00:*")
* new PartTime("*:00:00.000")
* new PartTime("*:*:30")
* new PartTime("1970-1-1T00:00:00.000")
* ```
* @param time String value representing a parttime. The string should be in a format recognized by the PartTime.parse() method (yyyy-mm-ddT00:00:00.000).
*/
constructor(time?: string | PartTime.TimeProps);
/** such as 2014 */
year?: number;
/** 1-12 (not 0-11) */
month?: number;
/** 1-31 */
date?: number;
/** 0-24 */
hour?: number;
/** 0-59 */
minute?: number;
/** 0-59 */
second?: number;
/** 0-999 */
millisecond?: number;
private static _levels;
/**
* get parttime data from parttime string
* @param timeString String value representing a parttime. The string should be in a format yyyy-mm-ddT00:00:00.000.
* @return Hash data representing parttime.
*/
static parse(timeString: string): PartTime.TimeProps;
/** the year */
getFullYear(): number | undefined;
/** the month (0-11) */
getMonth(): number | undefined;
/** the date */
getDate(): number | undefined;
/** the hour */
getHours(): number | undefined;
/** the minutes */
getMinutes(): number | undefined;
/** the seconds */
getSeconds(): number | undefined;
/** the milliseconds */
getMilliseconds(): number | undefined;
/**
* compare with DateLike
*
* if this < date then negative else if this > date then positive else 0
* @param date_c Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps
*/
compare(date_c: PartTime.DateLike | PartTime.TimeProps): number;
/**
* equals with DateLike
*
* @param date_c Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps
*/
equals(date_c: PartTime.DateLike | PartTime.TimeProps): boolean;
/**
* compare with DateLike
*
* if date1 < date2 then negative else if date1 > date2 then positive else 0
* @param date1 Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps
* @param date2 Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps
*/
static compare(date1: PartTime.DateLike | PartTime.TimeProps, date2: PartTime.DateLike | PartTime.TimeProps): number;
/**
* equals with DateLike
*
* @param date1 Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps
* @param date2 Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps
*/
static equals(date1: PartTime.DateLike | PartTime.TimeProps, date2: PartTime.DateLike | PartTime.TimeProps): boolean;
private elementToString;
/** @return yyyy-mm-ddT00:00:00.000. */
toString(): string;
/** @return yyyy-mm-dd. */
toDateString(): string;
/** @return 00:00:00.000. */
toTimeString(): string;
}
declare namespace PartTime {
interface TimeProps {
/** such as 2014 */
year?: number;
/** 1-12 (not 0-11) */
month?: number;
/** 1-31 */
date?: number;
/** 0-24 */
hour?: number;
/** 0-59 */
minute?: number;
/** 0-59 */
second?: number;
/** 0-999 */
millisecond?: number;
}
interface DateLike {
/** the year */
getFullYear(): number | undefined;
/** the month (0-11) */
getMonth(): number | undefined;
/** the date */
getDate(): number | undefined;
/** the hour */
getHours(): number | undefined;
/** the minutes */
getMinutes(): number | undefined;
/** the seconds */
getSeconds(): number | undefined;
/** the milliseconds */
getMilliseconds(): number | undefined;
}
}
export = PartTime;