rrule-temporal 0.3.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -6
- package/dist/chunk-6VZV7PDA.js +1252 -0
- package/dist/chunk-U2SCUIWP.js +1212 -0
- package/dist/index.cjs +203 -207
- package/dist/index.d.cts +33 -8
- package/dist/index.d.ts +33 -8
- package/dist/index.js +3 -1249
- package/dist/totext.cjs +1884 -0
- package/dist/totext.d.cts +6 -0
- package/dist/totext.d.ts +6 -0
- package/dist/totext.js +615 -0
- package/package.json +10 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,28 +1,55 @@
|
|
|
1
1
|
import { Temporal } from '@js-temporal/polyfill';
|
|
2
2
|
|
|
3
|
-
type DateFormatter = (year: number, month: string, day: number) => string;
|
|
4
3
|
type Freq = "YEARLY" | "MONTHLY" | "WEEKLY" | "DAILY" | "HOURLY" | "MINUTELY" | "SECONDLY";
|
|
4
|
+
/**
|
|
5
|
+
* Shared options for all rule constructors.
|
|
6
|
+
*/
|
|
5
7
|
interface BaseOpts {
|
|
8
|
+
/** Time zone identifier as defined in RFC 5545 §3.2.19. */
|
|
6
9
|
tzid?: string;
|
|
10
|
+
/** Safety cap when generating occurrences. */
|
|
7
11
|
maxIterations?: number;
|
|
12
|
+
/** Include DTSTART as an occurrence even if it does not match the rule pattern. */
|
|
13
|
+
includeDtstart?: boolean;
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Manual rule definition following the recurrence rule parts defined in
|
|
17
|
+
* RFC 5545 §3.3.10.
|
|
18
|
+
*/
|
|
9
19
|
interface ManualOpts extends BaseOpts {
|
|
20
|
+
/** FREQ: recurrence frequency */
|
|
10
21
|
freq: Freq;
|
|
22
|
+
/** INTERVAL between each occurrence of {@link freq} */
|
|
11
23
|
interval?: number;
|
|
24
|
+
/** COUNT: total number of occurrences */
|
|
12
25
|
count?: number;
|
|
26
|
+
/** UNTIL: last possible occurrence */
|
|
13
27
|
until?: Temporal.ZonedDateTime;
|
|
28
|
+
/** BYHOUR: hours to include (0-23) */
|
|
14
29
|
byHour?: number[];
|
|
30
|
+
/** BYMINUTE: minutes to include (0-59) */
|
|
15
31
|
byMinute?: number[];
|
|
32
|
+
/** BYSECOND: seconds to include (0-59) */
|
|
16
33
|
bySecond?: number[];
|
|
34
|
+
/** BYDAY: list of weekdays e.g. ["MO","WE","FR"] */
|
|
17
35
|
byDay?: string[];
|
|
36
|
+
/** BYMONTH: months of the year (1-12) */
|
|
18
37
|
byMonth?: number[];
|
|
38
|
+
/** BYMONTHDAY: days of the month (1..31 or negative from end) */
|
|
19
39
|
byMonthDay?: number[];
|
|
40
|
+
/** BYYEARDAY: days of the year (1..366 or negative from end) */
|
|
20
41
|
byYearDay?: number[];
|
|
42
|
+
/** BYWEEKNO: ISO week numbers (1..53 or negative from end) */
|
|
21
43
|
byWeekNo?: number[];
|
|
44
|
+
/** BYSETPOS: select n-th occurrence(s) after other filters */
|
|
22
45
|
bySetPos?: number[];
|
|
46
|
+
/** WKST: weekday on which the week starts ("MO".."SU") */
|
|
23
47
|
wkst?: string;
|
|
48
|
+
/** RDATE: additional dates to include */
|
|
24
49
|
rDate?: Temporal.ZonedDateTime[];
|
|
50
|
+
/** EXDATE: exception dates to exclude */
|
|
25
51
|
exDate?: Temporal.ZonedDateTime[];
|
|
52
|
+
/** DTSTART: first occurrence */
|
|
26
53
|
dtstart: Temporal.ZonedDateTime;
|
|
27
54
|
}
|
|
28
55
|
interface IcsOpts extends BaseOpts {
|
|
@@ -34,9 +61,10 @@ declare class RRuleTemporal {
|
|
|
34
61
|
private originalDtstart;
|
|
35
62
|
private opts;
|
|
36
63
|
private maxIterations;
|
|
37
|
-
|
|
64
|
+
private includeDtstart;
|
|
65
|
+
constructor(params: ({
|
|
38
66
|
rruleString: string;
|
|
39
|
-
} | ManualOpts);
|
|
67
|
+
} & BaseOpts) | ManualOpts);
|
|
40
68
|
private sanitizeOpts;
|
|
41
69
|
private rawAdvance;
|
|
42
70
|
/** Expand one base ZonedDateTime into all BYHOUR × BYMINUTE × BYSECOND
|
|
@@ -109,10 +137,7 @@ declare class RRuleTemporal {
|
|
|
109
137
|
*/
|
|
110
138
|
previous(before?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
|
|
111
139
|
toString(): string;
|
|
112
|
-
|
|
113
|
-
* Convert this rule to a human readable English description.
|
|
114
|
-
*/
|
|
115
|
-
toText(formatter?: DateFormatter): string;
|
|
140
|
+
private joinDates;
|
|
116
141
|
/**
|
|
117
142
|
* Given any date in a month, return all the ZonedDateTimes in that month
|
|
118
143
|
* matching your opts.byDay and opts.byMonth (or the single "same day" if no BYDAY).
|
|
@@ -128,4 +153,4 @@ declare class RRuleTemporal {
|
|
|
128
153
|
private mergeRDates;
|
|
129
154
|
}
|
|
130
155
|
|
|
131
|
-
export { type
|
|
156
|
+
export { type RRuleOptions, RRuleTemporal };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,55 @@
|
|
|
1
1
|
import { Temporal } from '@js-temporal/polyfill';
|
|
2
2
|
|
|
3
|
-
type DateFormatter = (year: number, month: string, day: number) => string;
|
|
4
3
|
type Freq = "YEARLY" | "MONTHLY" | "WEEKLY" | "DAILY" | "HOURLY" | "MINUTELY" | "SECONDLY";
|
|
4
|
+
/**
|
|
5
|
+
* Shared options for all rule constructors.
|
|
6
|
+
*/
|
|
5
7
|
interface BaseOpts {
|
|
8
|
+
/** Time zone identifier as defined in RFC 5545 §3.2.19. */
|
|
6
9
|
tzid?: string;
|
|
10
|
+
/** Safety cap when generating occurrences. */
|
|
7
11
|
maxIterations?: number;
|
|
12
|
+
/** Include DTSTART as an occurrence even if it does not match the rule pattern. */
|
|
13
|
+
includeDtstart?: boolean;
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Manual rule definition following the recurrence rule parts defined in
|
|
17
|
+
* RFC 5545 §3.3.10.
|
|
18
|
+
*/
|
|
9
19
|
interface ManualOpts extends BaseOpts {
|
|
20
|
+
/** FREQ: recurrence frequency */
|
|
10
21
|
freq: Freq;
|
|
22
|
+
/** INTERVAL between each occurrence of {@link freq} */
|
|
11
23
|
interval?: number;
|
|
24
|
+
/** COUNT: total number of occurrences */
|
|
12
25
|
count?: number;
|
|
26
|
+
/** UNTIL: last possible occurrence */
|
|
13
27
|
until?: Temporal.ZonedDateTime;
|
|
28
|
+
/** BYHOUR: hours to include (0-23) */
|
|
14
29
|
byHour?: number[];
|
|
30
|
+
/** BYMINUTE: minutes to include (0-59) */
|
|
15
31
|
byMinute?: number[];
|
|
32
|
+
/** BYSECOND: seconds to include (0-59) */
|
|
16
33
|
bySecond?: number[];
|
|
34
|
+
/** BYDAY: list of weekdays e.g. ["MO","WE","FR"] */
|
|
17
35
|
byDay?: string[];
|
|
36
|
+
/** BYMONTH: months of the year (1-12) */
|
|
18
37
|
byMonth?: number[];
|
|
38
|
+
/** BYMONTHDAY: days of the month (1..31 or negative from end) */
|
|
19
39
|
byMonthDay?: number[];
|
|
40
|
+
/** BYYEARDAY: days of the year (1..366 or negative from end) */
|
|
20
41
|
byYearDay?: number[];
|
|
42
|
+
/** BYWEEKNO: ISO week numbers (1..53 or negative from end) */
|
|
21
43
|
byWeekNo?: number[];
|
|
44
|
+
/** BYSETPOS: select n-th occurrence(s) after other filters */
|
|
22
45
|
bySetPos?: number[];
|
|
46
|
+
/** WKST: weekday on which the week starts ("MO".."SU") */
|
|
23
47
|
wkst?: string;
|
|
48
|
+
/** RDATE: additional dates to include */
|
|
24
49
|
rDate?: Temporal.ZonedDateTime[];
|
|
50
|
+
/** EXDATE: exception dates to exclude */
|
|
25
51
|
exDate?: Temporal.ZonedDateTime[];
|
|
52
|
+
/** DTSTART: first occurrence */
|
|
26
53
|
dtstart: Temporal.ZonedDateTime;
|
|
27
54
|
}
|
|
28
55
|
interface IcsOpts extends BaseOpts {
|
|
@@ -34,9 +61,10 @@ declare class RRuleTemporal {
|
|
|
34
61
|
private originalDtstart;
|
|
35
62
|
private opts;
|
|
36
63
|
private maxIterations;
|
|
37
|
-
|
|
64
|
+
private includeDtstart;
|
|
65
|
+
constructor(params: ({
|
|
38
66
|
rruleString: string;
|
|
39
|
-
} | ManualOpts);
|
|
67
|
+
} & BaseOpts) | ManualOpts);
|
|
40
68
|
private sanitizeOpts;
|
|
41
69
|
private rawAdvance;
|
|
42
70
|
/** Expand one base ZonedDateTime into all BYHOUR × BYMINUTE × BYSECOND
|
|
@@ -109,10 +137,7 @@ declare class RRuleTemporal {
|
|
|
109
137
|
*/
|
|
110
138
|
previous(before?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
|
|
111
139
|
toString(): string;
|
|
112
|
-
|
|
113
|
-
* Convert this rule to a human readable English description.
|
|
114
|
-
*/
|
|
115
|
-
toText(formatter?: DateFormatter): string;
|
|
140
|
+
private joinDates;
|
|
116
141
|
/**
|
|
117
142
|
* Given any date in a month, return all the ZonedDateTimes in that month
|
|
118
143
|
* matching your opts.byDay and opts.byMonth (or the single "same day" if no BYDAY).
|
|
@@ -128,4 +153,4 @@ declare class RRuleTemporal {
|
|
|
128
153
|
private mergeRDates;
|
|
129
154
|
}
|
|
130
155
|
|
|
131
|
-
export { type
|
|
156
|
+
export { type RRuleOptions, RRuleTemporal };
|