rrule-temporal 0.3.1 → 1.0.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 +3 -3
- package/dist/chunk-U2SCUIWP.js +1212 -0
- package/dist/index.cjs +243 -180
- package/dist/index.d.cts +41 -7
- package/dist/index.d.ts +41 -7
- package/dist/index.js +3 -1145
- package/dist/totext.cjs +1424 -0
- package/dist/totext.d.cts +6 -0
- package/dist/totext.d.ts +6 -0
- package/dist/totext.js +192 -0
- package/package.json +9 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,26 +1,56 @@
|
|
|
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
|
+
*
|
|
7
|
+
* @property tzid - Time zone identifier as defined in RFC 5545 §3.2.19.
|
|
8
|
+
* @property maxIterations - Safety cap when generating occurrences.
|
|
9
|
+
* @property includeDtstart - Include DTSTART even if it does not match the rule.
|
|
10
|
+
*/
|
|
5
11
|
interface BaseOpts {
|
|
6
12
|
tzid?: string;
|
|
13
|
+
maxIterations?: number;
|
|
14
|
+
includeDtstart?: boolean;
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Manual rule definition following the recurrence rule parts defined in
|
|
18
|
+
* RFC 5545 §3.3.10.
|
|
19
|
+
*/
|
|
8
20
|
interface ManualOpts extends BaseOpts {
|
|
21
|
+
/** FREQ: recurrence frequency */
|
|
9
22
|
freq: Freq;
|
|
23
|
+
/** INTERVAL between each occurrence of {@link freq} */
|
|
10
24
|
interval?: number;
|
|
25
|
+
/** COUNT: total number of occurrences */
|
|
11
26
|
count?: number;
|
|
27
|
+
/** UNTIL: last possible occurrence */
|
|
12
28
|
until?: Temporal.ZonedDateTime;
|
|
29
|
+
/** BYHOUR: hours to include (0-23) */
|
|
13
30
|
byHour?: number[];
|
|
31
|
+
/** BYMINUTE: minutes to include (0-59) */
|
|
14
32
|
byMinute?: number[];
|
|
33
|
+
/** BYSECOND: seconds to include (0-59) */
|
|
15
34
|
bySecond?: number[];
|
|
35
|
+
/** BYDAY: list of weekdays e.g. ["MO","WE","FR"] */
|
|
16
36
|
byDay?: string[];
|
|
37
|
+
/** BYMONTH: months of the year (1-12) */
|
|
17
38
|
byMonth?: number[];
|
|
39
|
+
/** BYMONTHDAY: days of the month (1..31 or negative from end) */
|
|
18
40
|
byMonthDay?: number[];
|
|
41
|
+
/** BYYEARDAY: days of the year (1..366 or negative from end) */
|
|
19
42
|
byYearDay?: number[];
|
|
43
|
+
/** BYWEEKNO: ISO week numbers (1..53 or negative from end) */
|
|
20
44
|
byWeekNo?: number[];
|
|
45
|
+
/** BYSETPOS: select n-th occurrence(s) after other filters */
|
|
21
46
|
bySetPos?: number[];
|
|
47
|
+
/** WKST: weekday on which the week starts ("MO".."SU") */
|
|
22
48
|
wkst?: string;
|
|
23
|
-
|
|
49
|
+
/** RDATE: additional dates to include */
|
|
50
|
+
rDate?: Temporal.ZonedDateTime[];
|
|
51
|
+
/** EXDATE: exception dates to exclude */
|
|
52
|
+
exDate?: Temporal.ZonedDateTime[];
|
|
53
|
+
/** DTSTART: first occurrence */
|
|
24
54
|
dtstart: Temporal.ZonedDateTime;
|
|
25
55
|
}
|
|
26
56
|
interface IcsOpts extends BaseOpts {
|
|
@@ -31,6 +61,8 @@ declare class RRuleTemporal {
|
|
|
31
61
|
private tzid;
|
|
32
62
|
private originalDtstart;
|
|
33
63
|
private opts;
|
|
64
|
+
private maxIterations;
|
|
65
|
+
private includeDtstart;
|
|
34
66
|
constructor(params: {
|
|
35
67
|
rruleString: string;
|
|
36
68
|
} | ManualOpts);
|
|
@@ -64,6 +96,12 @@ declare class RRuleTemporal {
|
|
|
64
96
|
* @returns Merged and deduplicated array of dates
|
|
65
97
|
*/
|
|
66
98
|
private mergeAndDeduplicateRDates;
|
|
99
|
+
/**
|
|
100
|
+
* Excludes exDate entries from the given array of dates.
|
|
101
|
+
* @param dates - Array of dates to filter
|
|
102
|
+
* @returns Filtered array with exDate entries removed
|
|
103
|
+
*/
|
|
104
|
+
private excludeExDates;
|
|
67
105
|
/**
|
|
68
106
|
* Applies count limit and merges rDates with the rule-generated dates.
|
|
69
107
|
* @param dates - Array of dates generated by the rule
|
|
@@ -100,10 +138,6 @@ declare class RRuleTemporal {
|
|
|
100
138
|
*/
|
|
101
139
|
previous(before?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
|
|
102
140
|
toString(): string;
|
|
103
|
-
/**
|
|
104
|
-
* Convert this rule to a human readable English description.
|
|
105
|
-
*/
|
|
106
|
-
toText(formatter?: DateFormatter): string;
|
|
107
141
|
/**
|
|
108
142
|
* Given any date in a month, return all the ZonedDateTimes in that month
|
|
109
143
|
* matching your opts.byDay and opts.byMonth (or the single "same day" if no BYDAY).
|
|
@@ -119,4 +153,4 @@ declare class RRuleTemporal {
|
|
|
119
153
|
private mergeRDates;
|
|
120
154
|
}
|
|
121
155
|
|
|
122
|
-
export { type
|
|
156
|
+
export { type RRuleOptions, RRuleTemporal };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,56 @@
|
|
|
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
|
+
*
|
|
7
|
+
* @property tzid - Time zone identifier as defined in RFC 5545 §3.2.19.
|
|
8
|
+
* @property maxIterations - Safety cap when generating occurrences.
|
|
9
|
+
* @property includeDtstart - Include DTSTART even if it does not match the rule.
|
|
10
|
+
*/
|
|
5
11
|
interface BaseOpts {
|
|
6
12
|
tzid?: string;
|
|
13
|
+
maxIterations?: number;
|
|
14
|
+
includeDtstart?: boolean;
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Manual rule definition following the recurrence rule parts defined in
|
|
18
|
+
* RFC 5545 §3.3.10.
|
|
19
|
+
*/
|
|
8
20
|
interface ManualOpts extends BaseOpts {
|
|
21
|
+
/** FREQ: recurrence frequency */
|
|
9
22
|
freq: Freq;
|
|
23
|
+
/** INTERVAL between each occurrence of {@link freq} */
|
|
10
24
|
interval?: number;
|
|
25
|
+
/** COUNT: total number of occurrences */
|
|
11
26
|
count?: number;
|
|
27
|
+
/** UNTIL: last possible occurrence */
|
|
12
28
|
until?: Temporal.ZonedDateTime;
|
|
29
|
+
/** BYHOUR: hours to include (0-23) */
|
|
13
30
|
byHour?: number[];
|
|
31
|
+
/** BYMINUTE: minutes to include (0-59) */
|
|
14
32
|
byMinute?: number[];
|
|
33
|
+
/** BYSECOND: seconds to include (0-59) */
|
|
15
34
|
bySecond?: number[];
|
|
35
|
+
/** BYDAY: list of weekdays e.g. ["MO","WE","FR"] */
|
|
16
36
|
byDay?: string[];
|
|
37
|
+
/** BYMONTH: months of the year (1-12) */
|
|
17
38
|
byMonth?: number[];
|
|
39
|
+
/** BYMONTHDAY: days of the month (1..31 or negative from end) */
|
|
18
40
|
byMonthDay?: number[];
|
|
41
|
+
/** BYYEARDAY: days of the year (1..366 or negative from end) */
|
|
19
42
|
byYearDay?: number[];
|
|
43
|
+
/** BYWEEKNO: ISO week numbers (1..53 or negative from end) */
|
|
20
44
|
byWeekNo?: number[];
|
|
45
|
+
/** BYSETPOS: select n-th occurrence(s) after other filters */
|
|
21
46
|
bySetPos?: number[];
|
|
47
|
+
/** WKST: weekday on which the week starts ("MO".."SU") */
|
|
22
48
|
wkst?: string;
|
|
23
|
-
|
|
49
|
+
/** RDATE: additional dates to include */
|
|
50
|
+
rDate?: Temporal.ZonedDateTime[];
|
|
51
|
+
/** EXDATE: exception dates to exclude */
|
|
52
|
+
exDate?: Temporal.ZonedDateTime[];
|
|
53
|
+
/** DTSTART: first occurrence */
|
|
24
54
|
dtstart: Temporal.ZonedDateTime;
|
|
25
55
|
}
|
|
26
56
|
interface IcsOpts extends BaseOpts {
|
|
@@ -31,6 +61,8 @@ declare class RRuleTemporal {
|
|
|
31
61
|
private tzid;
|
|
32
62
|
private originalDtstart;
|
|
33
63
|
private opts;
|
|
64
|
+
private maxIterations;
|
|
65
|
+
private includeDtstart;
|
|
34
66
|
constructor(params: {
|
|
35
67
|
rruleString: string;
|
|
36
68
|
} | ManualOpts);
|
|
@@ -64,6 +96,12 @@ declare class RRuleTemporal {
|
|
|
64
96
|
* @returns Merged and deduplicated array of dates
|
|
65
97
|
*/
|
|
66
98
|
private mergeAndDeduplicateRDates;
|
|
99
|
+
/**
|
|
100
|
+
* Excludes exDate entries from the given array of dates.
|
|
101
|
+
* @param dates - Array of dates to filter
|
|
102
|
+
* @returns Filtered array with exDate entries removed
|
|
103
|
+
*/
|
|
104
|
+
private excludeExDates;
|
|
67
105
|
/**
|
|
68
106
|
* Applies count limit and merges rDates with the rule-generated dates.
|
|
69
107
|
* @param dates - Array of dates generated by the rule
|
|
@@ -100,10 +138,6 @@ declare class RRuleTemporal {
|
|
|
100
138
|
*/
|
|
101
139
|
previous(before?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
|
|
102
140
|
toString(): string;
|
|
103
|
-
/**
|
|
104
|
-
* Convert this rule to a human readable English description.
|
|
105
|
-
*/
|
|
106
|
-
toText(formatter?: DateFormatter): string;
|
|
107
141
|
/**
|
|
108
142
|
* Given any date in a month, return all the ZonedDateTimes in that month
|
|
109
143
|
* matching your opts.byDay and opts.byMonth (or the single "same day" if no BYDAY).
|
|
@@ -119,4 +153,4 @@ declare class RRuleTemporal {
|
|
|
119
153
|
private mergeRDates;
|
|
120
154
|
}
|
|
121
155
|
|
|
122
|
-
export { type
|
|
156
|
+
export { type RRuleOptions, RRuleTemporal };
|