ical-generator 8.1.2-develop.9 → 9.0.0-develop.1
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 +13 -19
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1329 -1329
- package/dist/index.d.ts +1329 -1329
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/package.json +126 -122
- package/src/alarm.ts +499 -454
- package/src/attendee.ts +364 -345
- package/src/calendar.ts +422 -439
- package/src/category.ts +5 -14
- package/src/event.ts +1293 -1118
- package/src/index.ts +19 -25
- package/src/tools.ts +348 -258
- package/src/types.ts +86 -75
package/dist/index.d.ts
CHANGED
|
@@ -1,359 +1,508 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
type ICalDateTimeValue = Date | ICalMomentStub | ICalMomentTimezoneStub | ICalLuxonDateTimeStub | ICalDayJsStub | string;
|
|
8
|
-
interface ICalRepeatingOptions {
|
|
9
|
-
freq: ICalEventRepeatingFreq;
|
|
10
|
-
count?: number;
|
|
11
|
-
interval?: number;
|
|
12
|
-
until?: ICalDateTimeValue;
|
|
13
|
-
byDay?: ICalWeekday[] | ICalWeekday;
|
|
14
|
-
byMonth?: number[] | number;
|
|
15
|
-
byMonthDay?: number[] | number;
|
|
16
|
-
bySetPos?: number[] | number;
|
|
17
|
-
exclude?: ICalDateTimeValue[] | ICalDateTimeValue;
|
|
18
|
-
startOfWeek?: ICalWeekday;
|
|
19
|
-
}
|
|
20
|
-
type ICalLocation = ICalLocationWithTitle | ICalLocationWithoutTitle;
|
|
21
|
-
interface ICalLocationWithTitle {
|
|
22
|
-
title: string;
|
|
23
|
-
address?: string;
|
|
24
|
-
radius?: number;
|
|
25
|
-
geo?: ICalGeo;
|
|
26
|
-
}
|
|
27
|
-
interface ICalLocationWithoutTitle {
|
|
28
|
-
geo: ICalGeo;
|
|
29
|
-
}
|
|
30
|
-
interface ICalGeo {
|
|
31
|
-
lat: number;
|
|
32
|
-
lon: number;
|
|
33
|
-
}
|
|
34
|
-
interface ICalOrganizer {
|
|
35
|
-
name: string;
|
|
36
|
-
email?: string;
|
|
37
|
-
mailto?: string;
|
|
38
|
-
sentBy?: string;
|
|
39
|
-
}
|
|
40
|
-
interface ICalDescription {
|
|
41
|
-
plain: string;
|
|
42
|
-
html?: string;
|
|
43
|
-
}
|
|
44
|
-
interface ICalTimezone {
|
|
45
|
-
name: string | null;
|
|
46
|
-
generator?: (timezone: string) => string | null;
|
|
47
|
-
}
|
|
48
|
-
interface ICalMomentStub {
|
|
49
|
-
format(format?: string): string;
|
|
50
|
-
clone(): ICalMomentStub;
|
|
51
|
-
utc(): ICalMomentStub;
|
|
52
|
-
toDate(): Date;
|
|
53
|
-
isValid(): boolean;
|
|
54
|
-
toJSON(): string;
|
|
55
|
-
}
|
|
56
|
-
interface ICalMomentTimezoneStub extends ICalMomentStub {
|
|
57
|
-
clone(): ICalMomentTimezoneStub;
|
|
58
|
-
utc(): ICalMomentTimezoneStub;
|
|
59
|
-
tz(): string | undefined;
|
|
60
|
-
tz(timezone: string): ICalMomentTimezoneStub;
|
|
61
|
-
}
|
|
62
|
-
interface ICalMomentDurationStub {
|
|
63
|
-
asSeconds(): number;
|
|
64
|
-
}
|
|
65
|
-
interface ICalLuxonDateTimeStub {
|
|
66
|
-
setZone(zone?: string): ICalLuxonDateTimeStub;
|
|
67
|
-
zone: {
|
|
68
|
-
type: string;
|
|
69
|
-
};
|
|
70
|
-
toFormat(fmt: string): string;
|
|
71
|
-
toJSDate(): Date;
|
|
72
|
-
get isValid(): boolean;
|
|
73
|
-
toJSON(): string | null;
|
|
74
|
-
}
|
|
75
|
-
interface ICalDayJsStub {
|
|
76
|
-
tz(zone?: string): ICalDayJsStub;
|
|
77
|
-
utc(): ICalDayJsStub;
|
|
78
|
-
format(format?: string): string;
|
|
79
|
-
toDate(): Date;
|
|
80
|
-
isValid(): boolean;
|
|
81
|
-
toJSON(): string;
|
|
82
|
-
}
|
|
83
|
-
interface ICalRRuleStub {
|
|
84
|
-
between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
|
|
85
|
-
toString(): string;
|
|
86
|
-
}
|
|
87
|
-
declare enum ICalEventRepeatingFreq {
|
|
88
|
-
SECONDLY = "SECONDLY",
|
|
89
|
-
MINUTELY = "MINUTELY",
|
|
90
|
-
HOURLY = "HOURLY",
|
|
91
|
-
DAILY = "DAILY",
|
|
92
|
-
WEEKLY = "WEEKLY",
|
|
93
|
-
MONTHLY = "MONTHLY",
|
|
94
|
-
YEARLY = "YEARLY"
|
|
95
|
-
}
|
|
96
|
-
declare enum ICalWeekday {
|
|
97
|
-
SU = "SU",
|
|
98
|
-
MO = "MO",
|
|
99
|
-
TU = "TU",
|
|
100
|
-
WE = "WE",
|
|
101
|
-
TH = "TH",
|
|
102
|
-
FR = "FR",
|
|
103
|
-
SA = "SA"
|
|
1
|
+
declare enum ICalAttendeeRole {
|
|
2
|
+
CHAIR = "CHAIR",
|
|
3
|
+
NON = "NON-PARTICIPANT",
|
|
4
|
+
OPT = "OPT-PARTICIPANT",
|
|
5
|
+
REQ = "REQ-PARTICIPANT"
|
|
104
6
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
7
|
+
declare enum ICalAttendeeStatus {
|
|
8
|
+
ACCEPTED = "ACCEPTED",
|
|
9
|
+
DECLINED = "DECLINED",
|
|
10
|
+
DELEGATED = "DELEGATED",
|
|
11
|
+
NEEDSACTION = "NEEDS-ACTION",
|
|
12
|
+
TENTATIVE = "TENTATIVE"
|
|
110
13
|
}
|
|
111
|
-
declare
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
interface ICalAttachment {
|
|
118
|
-
uri: string;
|
|
119
|
-
mime: string | null;
|
|
14
|
+
declare enum ICalAttendeeType {
|
|
15
|
+
GROUP = "GROUP",
|
|
16
|
+
INDIVIDUAL = "INDIVIDUAL",
|
|
17
|
+
RESOURCE = "RESOURCE",
|
|
18
|
+
ROOM = "ROOM",
|
|
19
|
+
UNKNOWN = "UNKNOWN"
|
|
120
20
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
attach?: string | ICalAttachment | null;
|
|
136
|
-
description?: string | null;
|
|
137
|
-
summary?: string | null;
|
|
138
|
-
attendees?: ICalAttendee[] | ICalAttendeeData[];
|
|
139
|
-
x?: {
|
|
21
|
+
interface ICalAttendeeData {
|
|
22
|
+
delegatedFrom?: ICalAttendee | ICalAttendeeData | null | string;
|
|
23
|
+
delegatedTo?: ICalAttendee | ICalAttendeeData | null | string;
|
|
24
|
+
delegatesFrom?: ICalAttendee | ICalAttendeeData | null | string;
|
|
25
|
+
delegatesTo?: ICalAttendee | ICalAttendeeData | null | string;
|
|
26
|
+
email: string;
|
|
27
|
+
mailto?: null | string;
|
|
28
|
+
name?: null | string;
|
|
29
|
+
role?: ICalAttendeeRole;
|
|
30
|
+
rsvp?: boolean | null;
|
|
31
|
+
sentBy?: null | string;
|
|
32
|
+
status?: ICalAttendeeStatus | null;
|
|
33
|
+
type?: ICalAttendeeType | null;
|
|
34
|
+
x?: [string, string][] | Record<string, string> | {
|
|
140
35
|
key: string;
|
|
141
36
|
value: string;
|
|
142
|
-
}[]
|
|
143
|
-
}
|
|
144
|
-
interface ICalAlarmRepeatData {
|
|
145
|
-
times: number;
|
|
146
|
-
interval: number;
|
|
37
|
+
}[];
|
|
147
38
|
}
|
|
148
|
-
interface
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
39
|
+
interface ICalAttendeeJSONData {
|
|
40
|
+
delegatedFrom: null | string;
|
|
41
|
+
delegatedTo: null | string;
|
|
42
|
+
email: string;
|
|
43
|
+
mailto: null | string;
|
|
44
|
+
name: null | string;
|
|
45
|
+
role: ICalAttendeeRole;
|
|
46
|
+
rsvp: boolean | null;
|
|
47
|
+
sentBy: null | string;
|
|
48
|
+
status: ICalAttendeeStatus | null;
|
|
49
|
+
type: ICalAttendeeType | null;
|
|
158
50
|
x: {
|
|
159
51
|
key: string;
|
|
160
52
|
value: string;
|
|
161
53
|
}[];
|
|
162
54
|
}
|
|
163
55
|
/**
|
|
164
|
-
* Usually you get an {@link
|
|
56
|
+
* Usually you get an {@link ICalAttendee} object like this:
|
|
165
57
|
*
|
|
166
58
|
* ```javascript
|
|
167
59
|
* import ical from 'ical-generator';
|
|
168
60
|
* const calendar = ical();
|
|
169
61
|
* const event = calendar.createEvent();
|
|
170
|
-
* const
|
|
62
|
+
* const attendee = event.createAttendee({ email: 'mail@example.com' });
|
|
171
63
|
* ```
|
|
172
64
|
*
|
|
173
|
-
* You can also use the {@link
|
|
65
|
+
* You can also use the {@link ICalAttendee} object directly:
|
|
174
66
|
*
|
|
175
67
|
* ```javascript
|
|
176
|
-
* import ical, {
|
|
177
|
-
* const
|
|
178
|
-
* event.
|
|
68
|
+
* import ical, {ICalAttendee} from 'ical-generator';
|
|
69
|
+
* const attendee = new ICalAttendee({ email: 'mail@example.com' });
|
|
70
|
+
* event.attendees([attendee]);
|
|
179
71
|
* ```
|
|
180
72
|
*/
|
|
181
|
-
declare class
|
|
73
|
+
declare class ICalAttendee {
|
|
182
74
|
private readonly data;
|
|
183
|
-
private readonly
|
|
75
|
+
private readonly parent;
|
|
184
76
|
/**
|
|
185
|
-
* Constructor of {@link ICalAttendee}. The event reference is
|
|
186
|
-
* to query the calendar's timezone
|
|
77
|
+
* Constructor of {@link ICalAttendee}. The event reference is
|
|
78
|
+
* required to query the calendar's timezone when required.
|
|
187
79
|
*
|
|
188
|
-
* @param data
|
|
189
|
-
* @param
|
|
80
|
+
* @param data Attendee Data
|
|
81
|
+
* @param parent Reference to ICalEvent object
|
|
190
82
|
*/
|
|
191
|
-
constructor(data:
|
|
83
|
+
constructor(data: ICalAttendeeData, parent: ICalAlarm | ICalEvent);
|
|
192
84
|
/**
|
|
193
|
-
* Get the
|
|
194
|
-
* @since 0.2.
|
|
85
|
+
* Get the attendee's delegated-from field
|
|
86
|
+
* @since 0.2.0
|
|
195
87
|
*/
|
|
196
|
-
|
|
88
|
+
delegatedFrom(): ICalAttendee | null;
|
|
197
89
|
/**
|
|
198
|
-
* Set the
|
|
199
|
-
*
|
|
200
|
-
*
|
|
90
|
+
* Set the attendee's delegated-from field
|
|
91
|
+
*
|
|
92
|
+
* Creates a new Attendee if the passed object is not already a
|
|
93
|
+
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
94
|
+
* `delegatedFrom` attributes.
|
|
95
|
+
*
|
|
96
|
+
* @param delegatedFrom
|
|
201
97
|
*/
|
|
202
|
-
|
|
98
|
+
delegatedFrom(delegatedFrom: ICalAttendee | ICalAttendeeData | null | string): this;
|
|
203
99
|
/**
|
|
204
|
-
* Get the
|
|
205
|
-
*
|
|
206
|
-
* a number, which will represent the seconds between
|
|
207
|
-
* alarm and event start. The number is negative, if the
|
|
208
|
-
* alarm is triggered after the event started.
|
|
209
|
-
*
|
|
210
|
-
* @since 0.2.1
|
|
100
|
+
* Get the attendee's delegated-to value.
|
|
101
|
+
* @since 0.2.0
|
|
211
102
|
*/
|
|
212
|
-
|
|
103
|
+
delegatedTo(): ICalAttendee | null;
|
|
213
104
|
/**
|
|
214
|
-
*
|
|
105
|
+
* Set the attendee's delegated-to field.
|
|
106
|
+
*
|
|
107
|
+
* Creates a new Attendee if the passed object is not already a
|
|
108
|
+
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
109
|
+
* `delegatedFrom` attributes.
|
|
110
|
+
*
|
|
111
|
+
* Will also set the `status` to `DELEGATED`, if attribute is set.
|
|
215
112
|
*
|
|
216
113
|
* ```javascript
|
|
217
114
|
* const cal = ical();
|
|
218
115
|
* const event = cal.createEvent();
|
|
219
|
-
* const
|
|
220
|
-
*
|
|
221
|
-
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
222
|
-
* alarm.trigger(new Date()); // -> now
|
|
223
|
-
* ```
|
|
116
|
+
* const attendee = cal.createAttendee();
|
|
224
117
|
*
|
|
225
|
-
*
|
|
226
|
-
|
|
227
|
-
* for details about supported values and timezone handling.
|
|
118
|
+
* attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
|
|
119
|
+
```
|
|
228
120
|
*
|
|
229
|
-
* @since 0.2.
|
|
121
|
+
* @since 0.2.0
|
|
230
122
|
*/
|
|
231
|
-
|
|
123
|
+
delegatedTo(delegatedTo: ICalAttendee | ICalAttendeeData | null | string): this;
|
|
232
124
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* If the value is `END` the alarm is triggerd relative to the event end time
|
|
125
|
+
* Create a new attendee this attendee delegates from and returns
|
|
126
|
+
* this new attendee. Creates a new attendee if the passed object
|
|
127
|
+
* is not already an {@link ICalAttendee}.
|
|
237
128
|
*
|
|
238
|
-
*
|
|
129
|
+
* ```javascript
|
|
130
|
+
* const cal = ical();
|
|
131
|
+
* const event = cal.createEvent();
|
|
132
|
+
* const attendee = cal.createAttendee();
|
|
133
|
+
*
|
|
134
|
+
* attendee.delegatesFrom({email: 'foo@bar.com', name: 'Foo'});
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @since 0.2.0
|
|
239
138
|
*/
|
|
240
|
-
|
|
139
|
+
delegatesFrom(options: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
241
140
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
141
|
+
* Create a new attendee this attendee delegates to and returns
|
|
142
|
+
* this new attendee. Creates a new attendee if the passed object
|
|
143
|
+
* is not already an {@link ICalAttendee}.
|
|
244
144
|
*
|
|
245
145
|
* ```javascript
|
|
246
146
|
* const cal = ical();
|
|
247
147
|
* const event = cal.createEvent();
|
|
248
|
-
* const
|
|
249
|
-
*
|
|
250
|
-
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
148
|
+
* const attendee = cal.createAttendee();
|
|
251
149
|
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
150
|
+
* attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
|
|
151
|
+
* ```
|
|
254
152
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* alarm.relatesTo('START'); // -> 10 minutes after event starts
|
|
258
|
-
* alarm.relatesTo('END'); // -> 10 minutes after event ends
|
|
259
|
-
* ```
|
|
260
|
-
* @since 4.0.1
|
|
153
|
+
* @since 0.2.0
|
|
261
154
|
*/
|
|
262
|
-
|
|
155
|
+
delegatesTo(options: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
263
156
|
/**
|
|
264
|
-
* Get the
|
|
265
|
-
*
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
157
|
+
* Get the attendee's email address
|
|
158
|
+
* @since 0.2.0
|
|
159
|
+
*/
|
|
160
|
+
email(): string;
|
|
161
|
+
/**
|
|
162
|
+
* Set the attendee's email address
|
|
163
|
+
* @since 0.2.0
|
|
164
|
+
*/
|
|
165
|
+
email(email: string): this;
|
|
166
|
+
/**
|
|
167
|
+
* Get the attendee's email address
|
|
168
|
+
* @since 1.3.0
|
|
169
|
+
*/
|
|
170
|
+
mailto(): null | string;
|
|
171
|
+
/**
|
|
172
|
+
* Set the attendee's email address
|
|
173
|
+
* @since 1.3.0
|
|
174
|
+
*/
|
|
175
|
+
mailto(mailto: null | string): this;
|
|
176
|
+
/**
|
|
177
|
+
* Get the attendee's name
|
|
178
|
+
* @since 0.2.0
|
|
179
|
+
*/
|
|
180
|
+
name(): null | string;
|
|
181
|
+
/**
|
|
182
|
+
* Set the attendee's name
|
|
183
|
+
* @since 0.2.0
|
|
184
|
+
*/
|
|
185
|
+
name(name: null | string): this;
|
|
186
|
+
/**
|
|
187
|
+
* Get attendee's role
|
|
188
|
+
* @since 0.2.0
|
|
189
|
+
*/
|
|
190
|
+
role(): ICalAttendeeRole;
|
|
191
|
+
/**
|
|
192
|
+
* Set the attendee's role, defaults to `REQ` / `REQ-PARTICIPANT`.
|
|
193
|
+
* Checkout {@link ICalAttendeeRole} for available roles.
|
|
269
194
|
*
|
|
195
|
+
* @since 0.2.0
|
|
196
|
+
*/
|
|
197
|
+
role(role: ICalAttendeeRole): this;
|
|
198
|
+
/**
|
|
199
|
+
* Get attendee's RSVP expectation
|
|
270
200
|
* @since 0.2.1
|
|
271
201
|
*/
|
|
272
|
-
|
|
202
|
+
rsvp(): boolean | null;
|
|
273
203
|
/**
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
*
|
|
280
|
-
*
|
|
204
|
+
* Set the attendee's RSVP expectation
|
|
205
|
+
* @since 0.2.1
|
|
206
|
+
*/
|
|
207
|
+
rsvp(rsvp: boolean | null): this;
|
|
208
|
+
/**
|
|
209
|
+
* Get the acting user's email adress
|
|
210
|
+
* @since 3.3.0
|
|
211
|
+
*/
|
|
212
|
+
sentBy(): null | string;
|
|
213
|
+
/**
|
|
214
|
+
* Set the acting user's email adress
|
|
215
|
+
* @since 3.3.0
|
|
216
|
+
*/
|
|
217
|
+
sentBy(email: null | string): this;
|
|
218
|
+
/**
|
|
219
|
+
* Get attendee's status
|
|
220
|
+
* @since 0.2.0
|
|
221
|
+
*/
|
|
222
|
+
status(): ICalAttendeeStatus | null;
|
|
223
|
+
/**
|
|
224
|
+
* Set the attendee's status. See {@link ICalAttendeeStatus}
|
|
225
|
+
* for available status options.
|
|
281
226
|
*
|
|
282
|
-
*
|
|
283
|
-
|
|
227
|
+
* @since 0.2.0
|
|
228
|
+
*/
|
|
229
|
+
status(status: ICalAttendeeStatus | null): this;
|
|
230
|
+
/**
|
|
231
|
+
* Return a shallow copy of the attendee's options for JSON stringification.
|
|
232
|
+
* Can be used for persistence.
|
|
284
233
|
*
|
|
285
|
-
*
|
|
286
|
-
|
|
287
|
-
|
|
234
|
+
* @since 0.2.4
|
|
235
|
+
*/
|
|
236
|
+
toJSON(): ICalAttendeeJSONData;
|
|
237
|
+
/**
|
|
238
|
+
* Return generated attendee as a string.
|
|
288
239
|
*
|
|
289
|
-
*
|
|
240
|
+
* ```javascript
|
|
241
|
+
* console.log(attendee.toString()); // → ATTENDEE;ROLE=…
|
|
242
|
+
* ```
|
|
290
243
|
*/
|
|
291
|
-
|
|
244
|
+
toString(): string;
|
|
292
245
|
/**
|
|
293
|
-
* Get
|
|
294
|
-
*
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
246
|
+
* Get attendee's type (a.k.a. CUTYPE)
|
|
247
|
+
* @since 0.2.3
|
|
248
|
+
*/
|
|
249
|
+
type(): ICalAttendeeType;
|
|
250
|
+
/**
|
|
251
|
+
* Set attendee's type (a.k.a. CUTYPE).
|
|
252
|
+
* See {@link ICalAttendeeType} for available status options.
|
|
298
253
|
*
|
|
299
|
-
* @since 0.2.
|
|
300
|
-
* @see {@link trigger}
|
|
301
|
-
* @see {@link triggerAfter}
|
|
254
|
+
* @since 0.2.3
|
|
302
255
|
*/
|
|
303
|
-
|
|
256
|
+
type(type: ICalAttendeeType | null): this;
|
|
304
257
|
/**
|
|
305
|
-
*
|
|
258
|
+
* Set X-* attributes. Woun't filter double attributes,
|
|
259
|
+
* which are also added by another method (e.g. status),
|
|
260
|
+
* so these attributes may be inserted twice.
|
|
306
261
|
*
|
|
307
262
|
* ```javascript
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
263
|
+
* attendee.x([
|
|
264
|
+
* {
|
|
265
|
+
* key: "X-MY-CUSTOM-ATTR",
|
|
266
|
+
* value: "1337!"
|
|
267
|
+
* }
|
|
268
|
+
* ]);
|
|
311
269
|
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
270
|
+
* attendee.x([
|
|
271
|
+
* ["X-MY-CUSTOM-ATTR", "1337!"]
|
|
272
|
+
* ]);
|
|
273
|
+
*
|
|
274
|
+
* attendee.x({
|
|
275
|
+
* "X-MY-CUSTOM-ATTR": "1337!"
|
|
276
|
+
* });
|
|
314
277
|
* ```
|
|
315
278
|
*
|
|
316
|
-
*
|
|
317
|
-
|
|
318
|
-
|
|
279
|
+
* @since 1.9.0
|
|
280
|
+
*/
|
|
281
|
+
x(keyOrArray: [string, string][] | Record<string, string> | {
|
|
282
|
+
key: string;
|
|
283
|
+
value: string;
|
|
284
|
+
}[]): this;
|
|
285
|
+
/**
|
|
286
|
+
* Set a X-* attribute. Woun't filter double attributes,
|
|
287
|
+
* which are also added by another method (e.g. status),
|
|
288
|
+
* so these attributes may be inserted twice.
|
|
319
289
|
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
290
|
+
* ```javascript
|
|
291
|
+
* attendee.x("X-MY-CUSTOM-ATTR", "1337!");
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @since 1.9.0
|
|
323
295
|
*/
|
|
324
|
-
|
|
296
|
+
x(keyOrArray: string, value: string): this;
|
|
325
297
|
/**
|
|
326
|
-
* Get
|
|
327
|
-
* @since
|
|
298
|
+
* Get all custom X-* attributes.
|
|
299
|
+
* @since 1.9.0
|
|
328
300
|
*/
|
|
329
|
-
|
|
301
|
+
x(): {
|
|
302
|
+
key: string;
|
|
303
|
+
value: string;
|
|
304
|
+
}[];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare enum ICalEventRepeatingFreq {
|
|
308
|
+
DAILY = "DAILY",
|
|
309
|
+
HOURLY = "HOURLY",
|
|
310
|
+
MINUTELY = "MINUTELY",
|
|
311
|
+
MONTHLY = "MONTHLY",
|
|
312
|
+
SECONDLY = "SECONDLY",
|
|
313
|
+
WEEKLY = "WEEKLY",
|
|
314
|
+
YEARLY = "YEARLY"
|
|
315
|
+
}
|
|
316
|
+
declare enum ICalWeekday {
|
|
317
|
+
FR = "FR",
|
|
318
|
+
MO = "MO",
|
|
319
|
+
SA = "SA",
|
|
320
|
+
SU = "SU",
|
|
321
|
+
TH = "TH",
|
|
322
|
+
TU = "TU",
|
|
323
|
+
WE = "WE"
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* ical-generator supports [native Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date),
|
|
327
|
+
* [moment.js](https://momentjs.com/) (and [moment-timezone](https://momentjs.com/timezone/), [Day.js](https://day.js.org/en/) and
|
|
328
|
+
* [Luxon](https://moment.github.io/luxon/)'s [DateTime](https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html)
|
|
329
|
+
* objects. You can also pass a string which is then passed to javascript's Date internally.
|
|
330
|
+
*/
|
|
331
|
+
type ICalDateTimeValue = Date | ICalDayJsStub | ICalLuxonDateTimeStub | ICalMomentStub | ICalMomentTimezoneStub | string;
|
|
332
|
+
interface ICalDayJsStub {
|
|
333
|
+
format(format?: string): string;
|
|
334
|
+
isValid(): boolean;
|
|
335
|
+
toDate(): Date;
|
|
336
|
+
toJSON(): string;
|
|
337
|
+
tz(zone?: string): ICalDayJsStub;
|
|
338
|
+
utc(): ICalDayJsStub;
|
|
339
|
+
}
|
|
340
|
+
interface ICalDescription {
|
|
341
|
+
html?: string;
|
|
342
|
+
plain: string;
|
|
343
|
+
}
|
|
344
|
+
interface ICalGeo {
|
|
345
|
+
lat: number;
|
|
346
|
+
lon: number;
|
|
347
|
+
}
|
|
348
|
+
type ICalLocation = ICalLocationWithoutTitle | ICalLocationWithTitle;
|
|
349
|
+
interface ICalLocationWithoutTitle {
|
|
350
|
+
geo: ICalGeo;
|
|
351
|
+
}
|
|
352
|
+
interface ICalLocationWithTitle {
|
|
353
|
+
address?: string;
|
|
354
|
+
geo?: ICalGeo;
|
|
355
|
+
radius?: number;
|
|
356
|
+
title: string;
|
|
357
|
+
}
|
|
358
|
+
interface ICalLuxonDateTimeStub {
|
|
359
|
+
get isValid(): boolean;
|
|
360
|
+
setZone(zone?: string): ICalLuxonDateTimeStub;
|
|
361
|
+
toFormat(fmt: string): string;
|
|
362
|
+
toJSDate(): Date;
|
|
363
|
+
toJSON(): null | string;
|
|
364
|
+
zone: {
|
|
365
|
+
type: string;
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
interface ICalMomentDurationStub {
|
|
369
|
+
asSeconds(): number;
|
|
370
|
+
}
|
|
371
|
+
interface ICalMomentStub {
|
|
372
|
+
clone(): ICalMomentStub;
|
|
373
|
+
format(format?: string): string;
|
|
374
|
+
isValid(): boolean;
|
|
375
|
+
toDate(): Date;
|
|
376
|
+
toJSON(): string;
|
|
377
|
+
utc(): ICalMomentStub;
|
|
378
|
+
}
|
|
379
|
+
interface ICalMomentTimezoneStub extends ICalMomentStub {
|
|
380
|
+
clone(): ICalMomentTimezoneStub;
|
|
381
|
+
tz(): string | undefined;
|
|
382
|
+
tz(timezone: string): ICalMomentTimezoneStub;
|
|
383
|
+
utc(): ICalMomentTimezoneStub;
|
|
384
|
+
}
|
|
385
|
+
interface ICalOrganizer {
|
|
386
|
+
email?: string;
|
|
387
|
+
mailto?: string;
|
|
388
|
+
name: string;
|
|
389
|
+
sentBy?: string;
|
|
390
|
+
}
|
|
391
|
+
interface ICalRepeatingOptions {
|
|
392
|
+
byDay?: ICalWeekday | ICalWeekday[];
|
|
393
|
+
byMonth?: number | number[];
|
|
394
|
+
byMonthDay?: number | number[];
|
|
395
|
+
bySetPos?: number | number[];
|
|
396
|
+
count?: number;
|
|
397
|
+
exclude?: ICalDateTimeValue | ICalDateTimeValue[];
|
|
398
|
+
freq: ICalEventRepeatingFreq;
|
|
399
|
+
interval?: number;
|
|
400
|
+
startOfWeek?: ICalWeekday;
|
|
401
|
+
until?: ICalDateTimeValue;
|
|
402
|
+
}
|
|
403
|
+
interface ICalRRuleStub {
|
|
404
|
+
between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
|
|
405
|
+
toString(): string;
|
|
406
|
+
}
|
|
407
|
+
interface ICalTimezone {
|
|
408
|
+
generator?: (timezone: string) => null | string;
|
|
409
|
+
name: null | string;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
declare enum ICalAlarmType {
|
|
413
|
+
audio = "audio",
|
|
414
|
+
display = "display",
|
|
415
|
+
email = "email"
|
|
416
|
+
}
|
|
417
|
+
interface ICalAlarmBaseData {
|
|
418
|
+
attach?: ICalAttachment | null | string;
|
|
419
|
+
attendees?: ICalAttendee[] | ICalAttendeeData[];
|
|
420
|
+
description?: null | string;
|
|
421
|
+
relatesTo?: ICalAlarmRelatesTo | null;
|
|
422
|
+
repeat?: ICalAlarmRepeatData | null;
|
|
423
|
+
summary?: null | string;
|
|
424
|
+
type?: ICalAlarmType;
|
|
425
|
+
x?: [string, string][] | Record<string, string> | {
|
|
426
|
+
key: string;
|
|
427
|
+
value: string;
|
|
428
|
+
}[];
|
|
429
|
+
}
|
|
430
|
+
type ICalAlarmData = ICalAlarmBaseData | ICalAlarmTriggerAfterData | ICalAlarmTriggerBeforeData | ICalAlarmTriggerData;
|
|
431
|
+
interface ICalAlarmJSONData {
|
|
432
|
+
attach: ICalAttachment | null;
|
|
433
|
+
attendees: ICalAttendee[];
|
|
434
|
+
description: null | string;
|
|
435
|
+
interval: null | number;
|
|
436
|
+
relatesTo: ICalAlarmRelatesTo | null;
|
|
437
|
+
repeat: ICalAlarmRepeatData | null;
|
|
438
|
+
summary: null | string;
|
|
439
|
+
trigger: number | string;
|
|
440
|
+
type: ICalAlarmType;
|
|
441
|
+
x: {
|
|
442
|
+
key: string;
|
|
443
|
+
value: string;
|
|
444
|
+
}[];
|
|
445
|
+
}
|
|
446
|
+
declare const ICalAlarmRelatesTo: {
|
|
447
|
+
readonly end: "END";
|
|
448
|
+
readonly start: "START";
|
|
449
|
+
};
|
|
450
|
+
type ICalAlarmRelatesTo = (typeof ICalAlarmRelatesTo)[keyof typeof ICalAlarmRelatesTo];
|
|
451
|
+
interface ICalAlarmRepeatData {
|
|
452
|
+
interval: number;
|
|
453
|
+
times: number;
|
|
454
|
+
}
|
|
455
|
+
type ICalAlarmTriggerAfterData = ICalAlarmBaseData & {
|
|
456
|
+
triggerAfter: ICalDateTimeValue | number;
|
|
457
|
+
};
|
|
458
|
+
type ICalAlarmTriggerBeforeData = ICalAlarmBaseData & {
|
|
459
|
+
triggerBefore: ICalDateTimeValue | number;
|
|
460
|
+
};
|
|
461
|
+
type ICalAlarmTriggerData = ICalAlarmBaseData & {
|
|
462
|
+
trigger: ICalDateTimeValue | number;
|
|
463
|
+
};
|
|
464
|
+
type ICalAlarmTypeValue = keyof ICalAlarmType;
|
|
465
|
+
interface ICalAttachment {
|
|
466
|
+
mime: null | string;
|
|
467
|
+
uri: string;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Usually you get an {@link ICalAlarm} object like this:
|
|
471
|
+
*
|
|
472
|
+
* ```javascript
|
|
473
|
+
* import ical from 'ical-generator';
|
|
474
|
+
* const calendar = ical();
|
|
475
|
+
* const event = calendar.createEvent();
|
|
476
|
+
* const alarm = event.createAlarm();
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* You can also use the {@link ICalAlarm} object directly:
|
|
480
|
+
*
|
|
481
|
+
* ```javascript
|
|
482
|
+
* import ical, {ICalAlarm} from 'ical-generator';
|
|
483
|
+
* const alarm = new ICalAlarm();
|
|
484
|
+
* event.alarms([alarm]);
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
declare class ICalAlarm {
|
|
488
|
+
private readonly data;
|
|
489
|
+
private readonly event;
|
|
330
490
|
/**
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* ```javascript
|
|
334
|
-
* const cal = ical();
|
|
335
|
-
* const event = cal.createEvent();
|
|
336
|
-
*
|
|
337
|
-
* // repeat the alarm 4 times every 5 minutes…
|
|
338
|
-
* cal.createAlarm({
|
|
339
|
-
* repeat: {
|
|
340
|
-
* times: 4,
|
|
341
|
-
* interval: 300
|
|
342
|
-
* }
|
|
343
|
-
* });
|
|
344
|
-
* ```
|
|
491
|
+
* Constructor of {@link ICalAttendee}. The event reference is required
|
|
492
|
+
* to query the calendar's timezone and summary when required.
|
|
345
493
|
*
|
|
346
|
-
* @
|
|
494
|
+
* @param data Alarm Data
|
|
495
|
+
* @param event Reference to ICalEvent object
|
|
347
496
|
*/
|
|
348
|
-
|
|
497
|
+
constructor(data: ICalAlarmData, event: ICalEvent);
|
|
349
498
|
/**
|
|
350
499
|
* Get Attachment
|
|
351
500
|
* @since 0.2.1
|
|
352
501
|
*/
|
|
353
|
-
attach(): {
|
|
502
|
+
attach(): null | {
|
|
503
|
+
mime: null | string;
|
|
354
504
|
uri: string;
|
|
355
|
-
|
|
356
|
-
} | null;
|
|
505
|
+
};
|
|
357
506
|
/**
|
|
358
507
|
* Set Alarm attachment. Used to set the alarm sound
|
|
359
508
|
* if alarm type is audio. Defaults to "Basso".
|
|
@@ -378,40 +527,21 @@ declare class ICalAlarm {
|
|
|
378
527
|
*
|
|
379
528
|
* @since 0.2.1
|
|
380
529
|
*/
|
|
381
|
-
attach(attachment: {
|
|
530
|
+
attach(attachment: null | string | {
|
|
531
|
+
mime?: null | string;
|
|
382
532
|
uri: string;
|
|
383
|
-
|
|
384
|
-
} | string | null): this;
|
|
385
|
-
/**
|
|
386
|
-
* Get the alarm description. Used to set the alarm message
|
|
387
|
-
* if alarm type is `display`. If the alarm type is `email`, it's
|
|
388
|
-
* used to set the email body. Defaults to the event's summary.
|
|
389
|
-
*
|
|
390
|
-
* @since 0.2.1
|
|
391
|
-
*/
|
|
392
|
-
description(): string | null;
|
|
393
|
-
/**
|
|
394
|
-
* Set the alarm description. Used to set the alarm message
|
|
395
|
-
* if alarm type is `display`. If the alarm type is `email`, it's
|
|
396
|
-
* used to set the email body. Defaults to the event's summary.
|
|
397
|
-
*
|
|
398
|
-
* @since 0.2.1
|
|
399
|
-
*/
|
|
400
|
-
description(description: string | null): this;
|
|
533
|
+
}): this;
|
|
401
534
|
/**
|
|
402
|
-
* Get
|
|
403
|
-
* if alarm type is `email`. Defaults to the event's summary.
|
|
404
|
-
*
|
|
535
|
+
* Get all attendees
|
|
405
536
|
* @since 7.0.0
|
|
406
537
|
*/
|
|
407
|
-
|
|
538
|
+
attendees(): ICalAttendee[];
|
|
408
539
|
/**
|
|
409
|
-
*
|
|
410
|
-
* if alarm type is display. Defaults to the event's summary.
|
|
540
|
+
* Add multiple attendees to your event
|
|
411
541
|
*
|
|
412
|
-
* @since 0.
|
|
542
|
+
* @since 7.0.0
|
|
413
543
|
*/
|
|
414
|
-
|
|
544
|
+
attendees(attendees: (ICalAttendee | ICalAttendeeData | string)[]): this;
|
|
415
545
|
/**
|
|
416
546
|
* Creates a new {@link ICalAttendee} and returns it. Use options to prefill
|
|
417
547
|
* the attendee's attributes. Calling this method without options will create
|
|
@@ -421,359 +551,244 @@ declare class ICalAlarm {
|
|
|
421
551
|
*/
|
|
422
552
|
createAttendee(data: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
423
553
|
/**
|
|
424
|
-
* Get
|
|
425
|
-
*
|
|
426
|
-
|
|
427
|
-
attendees(): ICalAttendee[];
|
|
428
|
-
/**
|
|
429
|
-
* Add multiple attendees to your event
|
|
430
|
-
*
|
|
431
|
-
* @since 7.0.0
|
|
432
|
-
*/
|
|
433
|
-
attendees(attendees: (ICalAttendee | ICalAttendeeData | string)[]): this;
|
|
434
|
-
/**
|
|
435
|
-
* Set X-* attributes. Woun't filter double attributes,
|
|
436
|
-
* which are also added by another method (e.g. type),
|
|
437
|
-
* so these attributes may be inserted twice.
|
|
438
|
-
*
|
|
439
|
-
* ```javascript
|
|
440
|
-
* alarm.x([
|
|
441
|
-
* {
|
|
442
|
-
* key: "X-MY-CUSTOM-ATTR",
|
|
443
|
-
* value: "1337!"
|
|
444
|
-
* }
|
|
445
|
-
* ]);
|
|
446
|
-
*
|
|
447
|
-
* alarm.x([
|
|
448
|
-
* ["X-MY-CUSTOM-ATTR", "1337!"]
|
|
449
|
-
* ]);
|
|
450
|
-
*
|
|
451
|
-
* alarm.x({
|
|
452
|
-
* "X-MY-CUSTOM-ATTR": "1337!"
|
|
453
|
-
* });
|
|
454
|
-
* ```
|
|
554
|
+
* Get the alarm description. Used to set the alarm message
|
|
555
|
+
* if alarm type is `display`. If the alarm type is `email`, it's
|
|
556
|
+
* used to set the email body. Defaults to the event's summary.
|
|
455
557
|
*
|
|
456
|
-
* @since
|
|
558
|
+
* @since 0.2.1
|
|
457
559
|
*/
|
|
458
|
-
|
|
459
|
-
key: string;
|
|
460
|
-
value: string;
|
|
461
|
-
}[] | [string, string][] | Record<string, string>): this;
|
|
560
|
+
description(): null | string;
|
|
462
561
|
/**
|
|
463
|
-
* Set
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
* ```javascript
|
|
468
|
-
* alarm.x("X-MY-CUSTOM-ATTR", "1337!");
|
|
469
|
-
* ```
|
|
562
|
+
* Set the alarm description. Used to set the alarm message
|
|
563
|
+
* if alarm type is `display`. If the alarm type is `email`, it's
|
|
564
|
+
* used to set the email body. Defaults to the event's summary.
|
|
470
565
|
*
|
|
471
|
-
* @since
|
|
472
|
-
*/
|
|
473
|
-
x(keyOrArray: string, value: string): this;
|
|
474
|
-
/**
|
|
475
|
-
* Get all custom X-* attributes.
|
|
476
|
-
* @since 1.9.0
|
|
566
|
+
* @since 0.2.1
|
|
477
567
|
*/
|
|
478
|
-
|
|
479
|
-
key: string;
|
|
480
|
-
value: string;
|
|
481
|
-
}[];
|
|
568
|
+
description(description: null | string): this;
|
|
482
569
|
/**
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
*
|
|
570
|
+
* Get to which time alarm trigger relates to.
|
|
571
|
+
* Can be either `START` or `END`. If the value is
|
|
572
|
+
* `START` the alarm is triggerd relative to the event start time.
|
|
573
|
+
* If the value is `END` the alarm is triggerd relative to the event end time
|
|
486
574
|
*
|
|
487
|
-
* @since 0.
|
|
575
|
+
* @since 4.0.1
|
|
488
576
|
*/
|
|
489
|
-
|
|
577
|
+
relatesTo(): ICalAlarmRelatesTo | null;
|
|
490
578
|
/**
|
|
491
|
-
*
|
|
579
|
+
* Use this method to set to which time alarm trigger relates to.
|
|
580
|
+
* Works only if trigger is a `number`
|
|
492
581
|
*
|
|
493
582
|
* ```javascript
|
|
494
|
-
* const
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*/
|
|
498
|
-
toString(): string;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
interface ICalAttendeeData {
|
|
502
|
-
name?: string | null;
|
|
503
|
-
email: string;
|
|
504
|
-
mailto?: string | null;
|
|
505
|
-
sentBy?: string | null;
|
|
506
|
-
status?: ICalAttendeeStatus | null;
|
|
507
|
-
role?: ICalAttendeeRole;
|
|
508
|
-
rsvp?: boolean | null;
|
|
509
|
-
type?: ICalAttendeeType | null;
|
|
510
|
-
delegatedTo?: ICalAttendee | ICalAttendeeData | string | null;
|
|
511
|
-
delegatedFrom?: ICalAttendee | ICalAttendeeData | string | null;
|
|
512
|
-
delegatesTo?: ICalAttendee | ICalAttendeeData | string | null;
|
|
513
|
-
delegatesFrom?: ICalAttendee | ICalAttendeeData | string | null;
|
|
514
|
-
x?: {
|
|
515
|
-
key: string;
|
|
516
|
-
value: string;
|
|
517
|
-
}[] | [string, string][] | Record<string, string>;
|
|
518
|
-
}
|
|
519
|
-
interface ICalAttendeeJSONData {
|
|
520
|
-
name: string | null;
|
|
521
|
-
email: string;
|
|
522
|
-
mailto: string | null;
|
|
523
|
-
sentBy: string | null;
|
|
524
|
-
status: ICalAttendeeStatus | null;
|
|
525
|
-
role: ICalAttendeeRole;
|
|
526
|
-
rsvp: boolean | null;
|
|
527
|
-
type: ICalAttendeeType | null;
|
|
528
|
-
delegatedTo: string | null;
|
|
529
|
-
delegatedFrom: string | null;
|
|
530
|
-
x: {
|
|
531
|
-
key: string;
|
|
532
|
-
value: string;
|
|
533
|
-
}[];
|
|
534
|
-
}
|
|
535
|
-
declare enum ICalAttendeeRole {
|
|
536
|
-
CHAIR = "CHAIR",
|
|
537
|
-
REQ = "REQ-PARTICIPANT",
|
|
538
|
-
OPT = "OPT-PARTICIPANT",
|
|
539
|
-
NON = "NON-PARTICIPANT"
|
|
540
|
-
}
|
|
541
|
-
declare enum ICalAttendeeStatus {
|
|
542
|
-
ACCEPTED = "ACCEPTED",
|
|
543
|
-
TENTATIVE = "TENTATIVE",
|
|
544
|
-
DECLINED = "DECLINED",
|
|
545
|
-
DELEGATED = "DELEGATED",
|
|
546
|
-
NEEDSACTION = "NEEDS-ACTION"
|
|
547
|
-
}
|
|
548
|
-
declare enum ICalAttendeeType {
|
|
549
|
-
INDIVIDUAL = "INDIVIDUAL",
|
|
550
|
-
GROUP = "GROUP",
|
|
551
|
-
RESOURCE = "RESOURCE",
|
|
552
|
-
ROOM = "ROOM",
|
|
553
|
-
UNKNOWN = "UNKNOWN"
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Usually you get an {@link ICalAttendee} object like this:
|
|
557
|
-
*
|
|
558
|
-
* ```javascript
|
|
559
|
-
* import ical from 'ical-generator';
|
|
560
|
-
* const calendar = ical();
|
|
561
|
-
* const event = calendar.createEvent();
|
|
562
|
-
* const attendee = event.createAttendee({ email: 'mail@example.com' });
|
|
563
|
-
* ```
|
|
564
|
-
*
|
|
565
|
-
* You can also use the {@link ICalAttendee} object directly:
|
|
566
|
-
*
|
|
567
|
-
* ```javascript
|
|
568
|
-
* import ical, {ICalAttendee} from 'ical-generator';
|
|
569
|
-
* const attendee = new ICalAttendee({ email: 'mail@example.com' });
|
|
570
|
-
* event.attendees([attendee]);
|
|
571
|
-
* ```
|
|
572
|
-
*/
|
|
573
|
-
declare class ICalAttendee {
|
|
574
|
-
private readonly data;
|
|
575
|
-
private readonly parent;
|
|
576
|
-
/**
|
|
577
|
-
* Constructor of {@link ICalAttendee}. The event reference is
|
|
578
|
-
* required to query the calendar's timezone when required.
|
|
583
|
+
* const cal = ical();
|
|
584
|
+
* const event = cal.createEvent();
|
|
585
|
+
* const alarm = cal.createAlarm();
|
|
579
586
|
*
|
|
580
|
-
*
|
|
581
|
-
* @param parent Reference to ICalEvent object
|
|
582
|
-
*/
|
|
583
|
-
constructor(data: ICalAttendeeData, parent: ICalEvent | ICalAlarm);
|
|
584
|
-
/**
|
|
585
|
-
* Get the attendee's name
|
|
586
|
-
* @since 0.2.0
|
|
587
|
-
*/
|
|
588
|
-
name(): string | null;
|
|
589
|
-
/**
|
|
590
|
-
* Set the attendee's name
|
|
591
|
-
* @since 0.2.0
|
|
592
|
-
*/
|
|
593
|
-
name(name: string | null): this;
|
|
594
|
-
/**
|
|
595
|
-
* Get the attendee's email address
|
|
596
|
-
* @since 0.2.0
|
|
597
|
-
*/
|
|
598
|
-
email(): string;
|
|
599
|
-
/**
|
|
600
|
-
* Set the attendee's email address
|
|
601
|
-
* @since 0.2.0
|
|
602
|
-
*/
|
|
603
|
-
email(email: string): this;
|
|
604
|
-
/**
|
|
605
|
-
* Get the attendee's email address
|
|
606
|
-
* @since 1.3.0
|
|
607
|
-
*/
|
|
608
|
-
mailto(): string | null;
|
|
609
|
-
/**
|
|
610
|
-
* Set the attendee's email address
|
|
611
|
-
* @since 1.3.0
|
|
612
|
-
*/
|
|
613
|
-
mailto(mailto: string | null): this;
|
|
614
|
-
/**
|
|
615
|
-
* Get the acting user's email adress
|
|
616
|
-
* @since 3.3.0
|
|
617
|
-
*/
|
|
618
|
-
sentBy(): string | null;
|
|
619
|
-
/**
|
|
620
|
-
* Set the acting user's email adress
|
|
621
|
-
* @since 3.3.0
|
|
622
|
-
*/
|
|
623
|
-
sentBy(email: string | null): this;
|
|
624
|
-
/**
|
|
625
|
-
* Get attendee's role
|
|
626
|
-
* @since 0.2.0
|
|
627
|
-
*/
|
|
628
|
-
role(): ICalAttendeeRole;
|
|
629
|
-
/**
|
|
630
|
-
* Set the attendee's role, defaults to `REQ` / `REQ-PARTICIPANT`.
|
|
631
|
-
* Checkout {@link ICalAttendeeRole} for available roles.
|
|
587
|
+
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
632
588
|
*
|
|
633
|
-
*
|
|
589
|
+
* alarm.relatesTo('START'); // -> 10 minutes before event starts
|
|
590
|
+
* alarm.relatesTo('END'); // -> 10 minutes before event ends
|
|
591
|
+
*
|
|
592
|
+
* alarm.trigger(-600); // -> 10 minutes after event starts
|
|
593
|
+
*
|
|
594
|
+
* alarm.relatesTo('START'); // -> 10 minutes after event starts
|
|
595
|
+
* alarm.relatesTo('END'); // -> 10 minutes after event ends
|
|
596
|
+
* ```
|
|
597
|
+
* @since 4.0.1
|
|
634
598
|
*/
|
|
635
|
-
|
|
599
|
+
relatesTo(relatesTo: ICalAlarmRelatesTo | null): this;
|
|
636
600
|
/**
|
|
637
|
-
* Get
|
|
601
|
+
* Get Alarm Repetitions
|
|
638
602
|
* @since 0.2.1
|
|
639
603
|
*/
|
|
640
|
-
|
|
604
|
+
repeat(): ICalAlarmRepeatData | null;
|
|
641
605
|
/**
|
|
642
|
-
* Set
|
|
606
|
+
* Set Alarm Repetitions. Use this to repeat the alarm.
|
|
607
|
+
*
|
|
608
|
+
* ```javascript
|
|
609
|
+
* const cal = ical();
|
|
610
|
+
* const event = cal.createEvent();
|
|
611
|
+
*
|
|
612
|
+
* // repeat the alarm 4 times every 5 minutes…
|
|
613
|
+
* cal.createAlarm({
|
|
614
|
+
* repeat: {
|
|
615
|
+
* times: 4,
|
|
616
|
+
* interval: 300
|
|
617
|
+
* }
|
|
618
|
+
* });
|
|
619
|
+
* ```
|
|
620
|
+
*
|
|
643
621
|
* @since 0.2.1
|
|
644
622
|
*/
|
|
645
|
-
|
|
623
|
+
repeat(repeat: ICalAlarmRepeatData | null): this;
|
|
646
624
|
/**
|
|
647
|
-
* Get
|
|
648
|
-
*
|
|
625
|
+
* Get the alarm summary. Used to set the email subject
|
|
626
|
+
* if alarm type is `email`. Defaults to the event's summary.
|
|
627
|
+
*
|
|
628
|
+
* @since 7.0.0
|
|
649
629
|
*/
|
|
650
|
-
|
|
630
|
+
summary(): null | string;
|
|
651
631
|
/**
|
|
652
|
-
* Set the
|
|
653
|
-
*
|
|
632
|
+
* Set the alarm summary. Used to set the email subject
|
|
633
|
+
* if alarm type is display. Defaults to the event's summary.
|
|
654
634
|
*
|
|
655
|
-
* @since 0.2.
|
|
635
|
+
* @since 0.2.1
|
|
656
636
|
*/
|
|
657
|
-
|
|
637
|
+
summary(summary: null | string): this;
|
|
658
638
|
/**
|
|
659
|
-
*
|
|
660
|
-
*
|
|
639
|
+
* Return a shallow copy of the alarm's options for JSON stringification.
|
|
640
|
+
* Third party objects like moment.js values are stringified as well. Can
|
|
641
|
+
* be used for persistence.
|
|
642
|
+
*
|
|
643
|
+
* @since 0.2.4
|
|
661
644
|
*/
|
|
662
|
-
|
|
645
|
+
toJSON(): ICalAlarmJSONData;
|
|
663
646
|
/**
|
|
664
|
-
*
|
|
665
|
-
* See {@link ICalAttendeeType} for available status options.
|
|
647
|
+
* Return generated event as a string.
|
|
666
648
|
*
|
|
667
|
-
*
|
|
649
|
+
* ```javascript
|
|
650
|
+
* const alarm = event.createAlarm();
|
|
651
|
+
* console.log(alarm.toString()); // → BEGIN:VALARM…
|
|
652
|
+
* ```
|
|
668
653
|
*/
|
|
669
|
-
|
|
654
|
+
toString(): string;
|
|
670
655
|
/**
|
|
671
|
-
* Get the
|
|
672
|
-
* @
|
|
656
|
+
* Get the trigger time for the alarm. Can either
|
|
657
|
+
* be a date and time value ({@link ICalDateTimeValue}) or
|
|
658
|
+
* a number, which will represent the seconds between
|
|
659
|
+
* alarm and event start. The number is negative, if the
|
|
660
|
+
* alarm is triggered after the event started.
|
|
661
|
+
*
|
|
662
|
+
* @since 0.2.1
|
|
673
663
|
*/
|
|
674
|
-
|
|
664
|
+
trigger(): ICalDateTimeValue | number;
|
|
675
665
|
/**
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
* Creates a new Attendee if the passed object is not already a
|
|
679
|
-
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
680
|
-
* `delegatedFrom` attributes.
|
|
681
|
-
*
|
|
682
|
-
* Will also set the `status` to `DELEGATED`, if attribute is set.
|
|
666
|
+
* Use this method to set the alarm time.
|
|
683
667
|
*
|
|
684
668
|
* ```javascript
|
|
685
669
|
* const cal = ical();
|
|
686
670
|
* const event = cal.createEvent();
|
|
687
|
-
* const
|
|
671
|
+
* const alarm = cal.createAlarm();
|
|
688
672
|
*
|
|
689
|
-
*
|
|
690
|
-
|
|
673
|
+
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
674
|
+
* alarm.trigger(new Date()); // -> now
|
|
675
|
+
* ```
|
|
691
676
|
*
|
|
692
|
-
*
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
*
|
|
697
|
-
* @since 0.2.0
|
|
677
|
+
* You can use any supported date object, see
|
|
678
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
679
|
+
* for details about supported values and timezone handling.
|
|
680
|
+
*
|
|
681
|
+
* @since 0.2.1
|
|
698
682
|
*/
|
|
699
|
-
|
|
683
|
+
trigger(trigger: Date | ICalDateTimeValue | number): this;
|
|
700
684
|
/**
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
685
|
+
* Get the trigger time for the alarm. Can either
|
|
686
|
+
* be a date and time value ({@link ICalDateTimeValue}) or
|
|
687
|
+
* a number, which will represent the seconds between
|
|
688
|
+
* alarm and event start. The number is negative, if the
|
|
689
|
+
* alarm is triggered before the event started.
|
|
706
690
|
*
|
|
707
|
-
* @
|
|
691
|
+
* @since 0.2.1
|
|
708
692
|
*/
|
|
709
|
-
|
|
693
|
+
triggerAfter(): ICalDateTimeValue | number;
|
|
710
694
|
/**
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
* is not already an {@link ICalAttendee}.
|
|
695
|
+
* Use this method to set the alarm time. Unlike `trigger`, this time
|
|
696
|
+
* the alarm takes place after the event has started.
|
|
714
697
|
*
|
|
715
698
|
* ```javascript
|
|
716
699
|
* const cal = ical();
|
|
717
700
|
* const event = cal.createEvent();
|
|
718
|
-
* const
|
|
701
|
+
* const alarm = cal.createAlarm();
|
|
719
702
|
*
|
|
720
|
-
*
|
|
703
|
+
* alarm.trigger(600); // -> 10 minutes after event starts
|
|
721
704
|
* ```
|
|
722
705
|
*
|
|
723
|
-
*
|
|
706
|
+
* You can use any supported date object, see
|
|
707
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
708
|
+
* for details about supported values and timezone handling.
|
|
709
|
+
*
|
|
710
|
+
* @since 0.2.1
|
|
724
711
|
*/
|
|
725
|
-
|
|
712
|
+
triggerAfter(trigger: ICalDateTimeValue | number): this;
|
|
726
713
|
/**
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
714
|
+
* Get the trigger time for the alarm. Can either
|
|
715
|
+
* be a date and time value ({@link ICalDateTimeValue}) or
|
|
716
|
+
* a number, which will represent the seconds between
|
|
717
|
+
* alarm and event start. The number is negative, if the
|
|
718
|
+
* alarm is triggered after the event started.
|
|
719
|
+
*
|
|
720
|
+
* @since 0.2.1
|
|
721
|
+
* @see {@link trigger}
|
|
722
|
+
* @see {@link triggerAfter}
|
|
723
|
+
*/
|
|
724
|
+
triggerBefore(trigger: ICalDateTimeValue | number): this;
|
|
725
|
+
/**
|
|
726
|
+
* Use this method to set the alarm time.
|
|
730
727
|
*
|
|
731
728
|
* ```javascript
|
|
732
729
|
* const cal = ical();
|
|
733
730
|
* const event = cal.createEvent();
|
|
734
|
-
* const
|
|
731
|
+
* const alarm = cal.createAlarm();
|
|
735
732
|
*
|
|
736
|
-
*
|
|
733
|
+
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
734
|
+
* alarm.trigger(new Date()); // -> now
|
|
737
735
|
* ```
|
|
738
736
|
*
|
|
739
|
-
*
|
|
737
|
+
* You can use any supported date object, see
|
|
738
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
739
|
+
* for details about supported values and timezone handling.
|
|
740
|
+
*
|
|
741
|
+
* @since 0.2.1
|
|
742
|
+
* @see {@link trigger}
|
|
743
|
+
* @see {@link triggerAfter}
|
|
740
744
|
*/
|
|
741
|
-
|
|
745
|
+
triggerBefore(): ICalDateTimeValue | number;
|
|
746
|
+
/**
|
|
747
|
+
* Get the alarm type
|
|
748
|
+
* @since 0.2.1
|
|
749
|
+
*/
|
|
750
|
+
type(type: ICalAlarmType): this;
|
|
751
|
+
/**
|
|
752
|
+
* Set the alarm type. See {@link ICalAlarmType}
|
|
753
|
+
* for available status options.
|
|
754
|
+
* @since 0.2.1
|
|
755
|
+
*/
|
|
756
|
+
type(): ICalAlarmType;
|
|
742
757
|
/**
|
|
743
758
|
* Set X-* attributes. Woun't filter double attributes,
|
|
744
|
-
* which are also added by another method (e.g.
|
|
759
|
+
* which are also added by another method (e.g. type),
|
|
745
760
|
* so these attributes may be inserted twice.
|
|
746
761
|
*
|
|
747
762
|
* ```javascript
|
|
748
|
-
*
|
|
763
|
+
* alarm.x([
|
|
749
764
|
* {
|
|
750
765
|
* key: "X-MY-CUSTOM-ATTR",
|
|
751
766
|
* value: "1337!"
|
|
752
767
|
* }
|
|
753
768
|
* ]);
|
|
754
769
|
*
|
|
755
|
-
*
|
|
770
|
+
* alarm.x([
|
|
756
771
|
* ["X-MY-CUSTOM-ATTR", "1337!"]
|
|
757
772
|
* ]);
|
|
758
773
|
*
|
|
759
|
-
*
|
|
774
|
+
* alarm.x({
|
|
760
775
|
* "X-MY-CUSTOM-ATTR": "1337!"
|
|
761
776
|
* });
|
|
762
777
|
* ```
|
|
763
778
|
*
|
|
764
779
|
* @since 1.9.0
|
|
765
780
|
*/
|
|
766
|
-
x(keyOrArray: {
|
|
781
|
+
x(keyOrArray: [string, string][] | Record<string, string> | {
|
|
767
782
|
key: string;
|
|
768
783
|
value: string;
|
|
769
|
-
}[]
|
|
784
|
+
}[]): this;
|
|
770
785
|
/**
|
|
771
786
|
* Set a X-* attribute. Woun't filter double attributes,
|
|
772
|
-
* which are also added by another method (e.g.
|
|
787
|
+
* which are also added by another method (e.g. type),
|
|
773
788
|
* so these attributes may be inserted twice.
|
|
774
789
|
*
|
|
775
790
|
* ```javascript
|
|
776
|
-
*
|
|
791
|
+
* alarm.x("X-MY-CUSTOM-ATTR", "1337!");
|
|
777
792
|
* ```
|
|
778
793
|
*
|
|
779
794
|
* @since 1.9.0
|
|
@@ -787,30 +802,15 @@ declare class ICalAttendee {
|
|
|
787
802
|
key: string;
|
|
788
803
|
value: string;
|
|
789
804
|
}[];
|
|
790
|
-
/**
|
|
791
|
-
* Return a shallow copy of the attendee's options for JSON stringification.
|
|
792
|
-
* Can be used for persistence.
|
|
793
|
-
*
|
|
794
|
-
* @since 0.2.4
|
|
795
|
-
*/
|
|
796
|
-
toJSON(): ICalAttendeeJSONData;
|
|
797
|
-
/**
|
|
798
|
-
* Return generated attendee as a string.
|
|
799
|
-
*
|
|
800
|
-
* ```javascript
|
|
801
|
-
* console.log(attendee.toString()); // → ATTENDEE;ROLE=…
|
|
802
|
-
* ```
|
|
803
|
-
*/
|
|
804
|
-
toString(): string;
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
interface ICalCategoryData {
|
|
808
808
|
name: string;
|
|
809
809
|
}
|
|
810
|
+
type ICalCategoryInternalData = ICalCategoryJSONData;
|
|
810
811
|
interface ICalCategoryJSONData {
|
|
811
812
|
name: string;
|
|
812
813
|
}
|
|
813
|
-
type ICalCategoryInternalData = ICalCategoryJSONData;
|
|
814
814
|
/**
|
|
815
815
|
* Usually you get an {@link ICalCategory} object like this:
|
|
816
816
|
*
|
|
@@ -863,100 +863,100 @@ declare class ICalCategory {
|
|
|
863
863
|
toString(): string;
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
-
declare enum ICalEventStatus {
|
|
867
|
-
CONFIRMED = "CONFIRMED",
|
|
868
|
-
TENTATIVE = "TENTATIVE",
|
|
869
|
-
CANCELLED = "CANCELLED"
|
|
870
|
-
}
|
|
871
866
|
declare enum ICalEventBusyStatus {
|
|
872
|
-
FREE = "FREE",
|
|
873
|
-
TENTATIVE = "TENTATIVE",
|
|
874
867
|
BUSY = "BUSY",
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
TRANSPARENT = "TRANSPARENT",
|
|
879
|
-
OPAQUE = "OPAQUE"
|
|
868
|
+
FREE = "FREE",
|
|
869
|
+
OOF = "OOF",
|
|
870
|
+
TENTATIVE = "TENTATIVE"
|
|
880
871
|
}
|
|
881
872
|
declare enum ICalEventClass {
|
|
882
|
-
|
|
873
|
+
CONFIDENTIAL = "CONFIDENTIAL",
|
|
883
874
|
PRIVATE = "PRIVATE",
|
|
884
|
-
|
|
875
|
+
PUBLIC = "PUBLIC"
|
|
876
|
+
}
|
|
877
|
+
declare enum ICalEventStatus {
|
|
878
|
+
CANCELLED = "CANCELLED",
|
|
879
|
+
CONFIRMED = "CONFIRMED",
|
|
880
|
+
TENTATIVE = "TENTATIVE"
|
|
881
|
+
}
|
|
882
|
+
declare enum ICalEventTransparency {
|
|
883
|
+
OPAQUE = "OPAQUE",
|
|
884
|
+
TRANSPARENT = "TRANSPARENT"
|
|
885
885
|
}
|
|
886
886
|
interface ICalEventData {
|
|
887
|
-
|
|
888
|
-
sequence?: number;
|
|
889
|
-
start: ICalDateTimeValue;
|
|
890
|
-
end?: ICalDateTimeValue | null;
|
|
891
|
-
recurrenceId?: ICalDateTimeValue | null;
|
|
892
|
-
timezone?: string | null;
|
|
893
|
-
stamp?: ICalDateTimeValue;
|
|
887
|
+
alarms?: ICalAlarm[] | ICalAlarmData[];
|
|
894
888
|
allDay?: boolean;
|
|
895
|
-
|
|
896
|
-
repeating?: ICalRepeatingOptions | ICalRRuleStub | string | null;
|
|
897
|
-
summary?: string;
|
|
898
|
-
location?: ICalLocation | string | null;
|
|
899
|
-
description?: ICalDescription | string | null;
|
|
900
|
-
organizer?: ICalOrganizer | string | null;
|
|
889
|
+
attachments?: string[];
|
|
901
890
|
attendees?: ICalAttendee[] | ICalAttendeeData[];
|
|
902
|
-
alarms?: ICalAlarm[] | ICalAlarmData[];
|
|
903
|
-
categories?: ICalCategory[] | ICalCategoryData[];
|
|
904
|
-
status?: ICalEventStatus | null;
|
|
905
891
|
busystatus?: ICalEventBusyStatus | null;
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
attachments?: string[];
|
|
909
|
-
transparency?: ICalEventTransparency | null;
|
|
892
|
+
categories?: ICalCategory[] | ICalCategoryData[];
|
|
893
|
+
class?: ICalEventClass | null;
|
|
910
894
|
created?: ICalDateTimeValue | null;
|
|
895
|
+
description?: ICalDescription | null | string;
|
|
896
|
+
end?: ICalDateTimeValue | null;
|
|
897
|
+
floating?: boolean;
|
|
898
|
+
id?: null | number | string;
|
|
911
899
|
lastModified?: ICalDateTimeValue | null;
|
|
912
|
-
|
|
913
|
-
|
|
900
|
+
location?: ICalLocation | null | string;
|
|
901
|
+
organizer?: ICalOrganizer | null | string;
|
|
902
|
+
priority?: null | number;
|
|
903
|
+
recurrenceId?: ICalDateTimeValue | null;
|
|
904
|
+
repeating?: ICalRepeatingOptions | ICalRRuleStub | null | string;
|
|
905
|
+
sequence?: number;
|
|
906
|
+
stamp?: ICalDateTimeValue;
|
|
907
|
+
start: ICalDateTimeValue;
|
|
908
|
+
status?: ICalEventStatus | null;
|
|
909
|
+
summary?: string;
|
|
910
|
+
timezone?: null | string;
|
|
911
|
+
transparency?: ICalEventTransparency | null;
|
|
912
|
+
url?: null | string;
|
|
913
|
+
x?: [string, string][] | Record<string, string> | {
|
|
914
914
|
key: string;
|
|
915
915
|
value: string;
|
|
916
|
-
}[]
|
|
916
|
+
}[];
|
|
917
917
|
}
|
|
918
918
|
interface ICalEventJSONData {
|
|
919
|
-
|
|
920
|
-
sequence: number;
|
|
921
|
-
start: string;
|
|
922
|
-
end: string | null;
|
|
923
|
-
recurrenceId: string | null;
|
|
924
|
-
timezone: string | null;
|
|
925
|
-
stamp: string;
|
|
919
|
+
alarms: ICalAlarm[];
|
|
926
920
|
allDay: boolean;
|
|
927
|
-
|
|
928
|
-
repeating: ICalEventJSONRepeatingData | string | null;
|
|
929
|
-
summary: string;
|
|
930
|
-
location: ICalLocation | null;
|
|
931
|
-
description: ICalDescription | null;
|
|
932
|
-
organizer: ICalOrganizer | null;
|
|
921
|
+
attachments: string[];
|
|
933
922
|
attendees: ICalAttendee[];
|
|
934
|
-
|
|
923
|
+
busystatus: ICalEventBusyStatus | null;
|
|
935
924
|
categories: ICalCategory[];
|
|
925
|
+
created: null | string;
|
|
926
|
+
description: ICalDescription | null;
|
|
927
|
+
end: null | string;
|
|
928
|
+
floating: boolean;
|
|
929
|
+
id: string;
|
|
930
|
+
lastModified: null | string;
|
|
931
|
+
location: ICalLocation | null;
|
|
932
|
+
organizer: ICalOrganizer | null;
|
|
933
|
+
priority?: null | number;
|
|
934
|
+
recurrenceId: null | string;
|
|
935
|
+
repeating: ICalEventJSONRepeatingData | null | string;
|
|
936
|
+
sequence: number;
|
|
937
|
+
stamp: string;
|
|
938
|
+
start: string;
|
|
936
939
|
status: ICalEventStatus | null;
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
url: string | null;
|
|
940
|
-
attachments: string[];
|
|
940
|
+
summary: string;
|
|
941
|
+
timezone: null | string;
|
|
941
942
|
transparency: ICalEventTransparency | null;
|
|
942
|
-
|
|
943
|
-
lastModified: string | null;
|
|
943
|
+
url: null | string;
|
|
944
944
|
x: {
|
|
945
945
|
key: string;
|
|
946
946
|
value: string;
|
|
947
947
|
}[];
|
|
948
948
|
}
|
|
949
949
|
interface ICalEventJSONRepeatingData {
|
|
950
|
-
freq: ICalEventRepeatingFreq;
|
|
951
|
-
count?: number;
|
|
952
|
-
interval?: number;
|
|
953
|
-
until?: ICalDateTimeValue;
|
|
954
950
|
byDay?: ICalWeekday[];
|
|
955
951
|
byMonth?: number[];
|
|
956
952
|
byMonthDay?: number[];
|
|
957
953
|
bySetPos?: number[];
|
|
954
|
+
count?: number;
|
|
958
955
|
exclude?: ICalDateTimeValue[];
|
|
956
|
+
freq: ICalEventRepeatingFreq;
|
|
957
|
+
interval?: number;
|
|
959
958
|
startOfWeek?: ICalWeekday;
|
|
959
|
+
until?: ICalDateTimeValue;
|
|
960
960
|
}
|
|
961
961
|
/**
|
|
962
962
|
* Usually you get an {@link ICalEvent} object like this:
|
|
@@ -967,8 +967,8 @@ interface ICalEventJSONRepeatingData {
|
|
|
967
967
|
* ```
|
|
968
968
|
*/
|
|
969
969
|
declare class ICalEvent {
|
|
970
|
-
private readonly data;
|
|
971
970
|
private readonly calendar;
|
|
971
|
+
private readonly data;
|
|
972
972
|
/**
|
|
973
973
|
* Constructor of [[`ICalEvent`]. The calendar reference is
|
|
974
974
|
* required to query the calendar's timezone when required.
|
|
@@ -978,70 +978,50 @@ declare class ICalEvent {
|
|
|
978
978
|
*/
|
|
979
979
|
constructor(data: ICalEventData, calendar: ICalCalendar);
|
|
980
980
|
/**
|
|
981
|
-
* Get
|
|
981
|
+
* Get all alarms
|
|
982
982
|
* @since 0.2.0
|
|
983
983
|
*/
|
|
984
|
-
|
|
984
|
+
alarms(): ICalAlarm[];
|
|
985
985
|
/**
|
|
986
|
-
*
|
|
987
|
-
* If not set, a UUID will be generated randomly.
|
|
986
|
+
* Add one or multiple alarms
|
|
988
987
|
*
|
|
989
|
-
*
|
|
990
|
-
|
|
991
|
-
id(id: string | number): this;
|
|
992
|
-
/**
|
|
993
|
-
* Get the event's ID
|
|
994
|
-
* @since 0.2.0
|
|
995
|
-
* @see {@link id}
|
|
996
|
-
*/
|
|
997
|
-
uid(): string;
|
|
998
|
-
/**
|
|
999
|
-
* Use this method to set the event's ID.
|
|
1000
|
-
* If not set, a UUID will be generated randomly.
|
|
988
|
+
* ```javascript
|
|
989
|
+
* const event = ical().createEvent();
|
|
1001
990
|
*
|
|
1002
|
-
*
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
* Get the event's SEQUENCE number. Use this method to get the event's
|
|
1007
|
-
* revision sequence number of the calendar component within a sequence of revisions.
|
|
991
|
+
* cal.alarms([
|
|
992
|
+
* {type: ICalAlarmType.display, trigger: 600},
|
|
993
|
+
* {type: ICalAlarmType.audio, trigger: 300}
|
|
994
|
+
* ]);
|
|
1008
995
|
*
|
|
1009
|
-
*
|
|
1010
|
-
|
|
1011
|
-
sequence(): number;
|
|
1012
|
-
/**
|
|
1013
|
-
* Set the event's SEQUENCE number. For a new event, this should be zero.
|
|
1014
|
-
* Each time the organizer makes a significant revision, the sequence
|
|
1015
|
-
* number should be incremented.
|
|
996
|
+
* cal.alarms(); // --> [ICalAlarm, ICalAlarm]
|
|
997
|
+
```
|
|
1016
998
|
*
|
|
1017
|
-
* @
|
|
999
|
+
* @since 0.2.0
|
|
1018
1000
|
*/
|
|
1019
|
-
|
|
1001
|
+
alarms(alarms: ICalAlarm[] | ICalAlarmData[]): this;
|
|
1020
1002
|
/**
|
|
1021
|
-
* Get the event
|
|
1022
|
-
* set. Can be any supported date object.
|
|
1023
|
-
*
|
|
1003
|
+
* Get the event's allDay flag
|
|
1024
1004
|
* @since 0.2.0
|
|
1025
1005
|
*/
|
|
1026
|
-
|
|
1006
|
+
allDay(): boolean;
|
|
1027
1007
|
/**
|
|
1028
|
-
* Set the
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1008
|
+
* Set the event's allDay flag.
|
|
1009
|
+
*
|
|
1010
|
+
* ```javascript
|
|
1011
|
+
* event.allDay(true); // → appointment is for the whole day
|
|
1012
|
+
* ```
|
|
1032
1013
|
*
|
|
1033
1014
|
* ```typescript
|
|
1034
1015
|
* import ical from 'ical-generator';
|
|
1035
1016
|
*
|
|
1036
1017
|
* const cal = ical();
|
|
1037
1018
|
*
|
|
1038
|
-
*
|
|
1039
|
-
* start: new Date('2020-01-01')
|
|
1019
|
+
* cal.createEvent({
|
|
1020
|
+
* start: new Date('2020-01-01'),
|
|
1021
|
+
* summary: 'Very Important Day',
|
|
1022
|
+
* allDay: true
|
|
1040
1023
|
* });
|
|
1041
1024
|
*
|
|
1042
|
-
* // overwrites old start date
|
|
1043
|
-
* event.start(new Date('2024-02-01'));
|
|
1044
|
-
*
|
|
1045
1025
|
* cal.toString();
|
|
1046
1026
|
* ```
|
|
1047
1027
|
*
|
|
@@ -1050,203 +1030,173 @@ declare class ICalEvent {
|
|
|
1050
1030
|
* VERSION:2.0
|
|
1051
1031
|
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1052
1032
|
* BEGIN:VEVENT
|
|
1053
|
-
* UID:
|
|
1033
|
+
* UID:1964fe8d-32c5-4f2a-bd62-7d9d7de5992b
|
|
1054
1034
|
* SEQUENCE:0
|
|
1055
|
-
* DTSTAMP:
|
|
1056
|
-
* DTSTART:
|
|
1057
|
-
*
|
|
1035
|
+
* DTSTAMP:20240212T191956Z
|
|
1036
|
+
* DTSTART;VALUE=DATE:20200101
|
|
1037
|
+
* X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
|
|
1038
|
+
* X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE
|
|
1039
|
+
* SUMMARY:Very Important Day
|
|
1058
1040
|
* END:VEVENT
|
|
1059
1041
|
* END:VCALENDAR
|
|
1060
1042
|
* ```
|
|
1061
1043
|
*
|
|
1062
1044
|
* @since 0.2.0
|
|
1063
1045
|
*/
|
|
1064
|
-
|
|
1046
|
+
allDay(allDay: boolean): this;
|
|
1065
1047
|
/**
|
|
1066
|
-
* Get
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
* @since 0.2.0
|
|
1048
|
+
* Get all attachment urls
|
|
1049
|
+
* @since 3.2.0-develop.1
|
|
1070
1050
|
*/
|
|
1071
|
-
|
|
1051
|
+
attachments(): string[];
|
|
1072
1052
|
/**
|
|
1073
|
-
*
|
|
1074
|
-
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1075
|
-
* for details about supported values and timezone handling.
|
|
1053
|
+
* Add one or multiple alarms
|
|
1076
1054
|
*
|
|
1077
|
-
*
|
|
1078
|
-
|
|
1079
|
-
end(end: ICalDateTimeValue | null): this;
|
|
1080
|
-
/**
|
|
1081
|
-
* Checks if the start date is after the end date and swaps them if necessary.
|
|
1082
|
-
* @private
|
|
1083
|
-
*/
|
|
1084
|
-
private swapStartAndEndIfRequired;
|
|
1085
|
-
/**
|
|
1086
|
-
* Get the event's recurrence id
|
|
1087
|
-
* @since 0.2.0
|
|
1088
|
-
*/
|
|
1089
|
-
recurrenceId(): ICalDateTimeValue | null;
|
|
1090
|
-
/**
|
|
1091
|
-
* Set the event's recurrence id. You can use any supported date object, see
|
|
1092
|
-
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1093
|
-
* for details about supported values and timezone handling.
|
|
1055
|
+
* ```javascript
|
|
1056
|
+
* const event = ical().createEvent();
|
|
1094
1057
|
*
|
|
1095
|
-
*
|
|
1058
|
+
* cal.attachments([
|
|
1059
|
+
* 'https://files.sebbo.net/calendar/attachments/foo',
|
|
1060
|
+
* 'https://files.sebbo.net/calendar/attachments/bar'
|
|
1061
|
+
* ]);
|
|
1062
|
+
*
|
|
1063
|
+
* cal.attachments(); // --> [string, string]
|
|
1064
|
+
```
|
|
1065
|
+
*
|
|
1066
|
+
* 3.2.0-develop.1
|
|
1096
1067
|
*/
|
|
1097
|
-
|
|
1068
|
+
attachments(attachments: string[]): this;
|
|
1098
1069
|
/**
|
|
1099
|
-
* Get
|
|
1100
|
-
* @since 0.2.
|
|
1070
|
+
* Get all attendees
|
|
1071
|
+
* @since 0.2.0
|
|
1101
1072
|
*/
|
|
1102
|
-
|
|
1073
|
+
attendees(): ICalAttendee[];
|
|
1103
1074
|
/**
|
|
1104
|
-
*
|
|
1105
|
-
* defined in both the event and the calendar, the time zone of the event
|
|
1106
|
-
* is used.
|
|
1107
|
-
*
|
|
1108
|
-
* Please note that if the time zone is set, ical-generator assumes
|
|
1109
|
-
* that all times are already in the correct time zone. Alternatively,
|
|
1110
|
-
* a `moment-timezone` or a Luxon object can be passed with `setZone`,
|
|
1111
|
-
* ical-generator will then set the time zone itself.
|
|
1075
|
+
* Add multiple attendees to your event
|
|
1112
1076
|
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1115
|
-
* (see [date-time form #2 in section 3.3.5 of RFC 554](https://tools.ietf.org/html/rfc5545#section-3.3.5)).
|
|
1077
|
+
* ```javascript
|
|
1078
|
+
* const event = ical().createEvent();
|
|
1116
1079
|
*
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1080
|
+
* cal.attendees([
|
|
1081
|
+
* {email: 'a@example.com', name: 'Person A'},
|
|
1082
|
+
* {email: 'b@example.com', name: 'Person B'}
|
|
1083
|
+
* ]);
|
|
1119
1084
|
*
|
|
1120
|
-
*
|
|
1121
|
-
* event.timezone('America/New_York');
|
|
1085
|
+
* cal.attendees(); // --> [ICalAttendee, ICalAttendee]
|
|
1122
1086
|
* ```
|
|
1123
1087
|
*
|
|
1124
|
-
* @see https://github.com/sebbo2002/ical-generator#-date-time--timezones
|
|
1125
|
-
* @since 0.2.6
|
|
1126
|
-
*/
|
|
1127
|
-
timezone(timezone: string | null): this;
|
|
1128
|
-
/**
|
|
1129
|
-
* Get the event's timestamp
|
|
1130
|
-
* @since 0.2.0
|
|
1131
|
-
* @see {@link timestamp}
|
|
1132
|
-
*/
|
|
1133
|
-
stamp(): ICalDateTimeValue;
|
|
1134
|
-
/**
|
|
1135
|
-
* Set the appointment date of creation. Defaults to the current time and date (`new Date()`). You can use
|
|
1136
|
-
* any supported date object, see [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1137
|
-
* for details about supported values and timezone handling.
|
|
1138
|
-
*
|
|
1139
1088
|
* @since 0.2.0
|
|
1140
|
-
* @see {@link timestamp}
|
|
1141
1089
|
*/
|
|
1142
|
-
|
|
1090
|
+
attendees(attendees: (ICalAttendee | ICalAttendeeData | string)[]): this;
|
|
1143
1091
|
/**
|
|
1144
|
-
* Get the event's
|
|
1145
|
-
* @since 0.2
|
|
1146
|
-
* @see {@link stamp}
|
|
1092
|
+
* Get the event's busy status
|
|
1093
|
+
* @since 1.0.2
|
|
1147
1094
|
*/
|
|
1148
|
-
|
|
1095
|
+
busystatus(): ICalEventBusyStatus | null;
|
|
1149
1096
|
/**
|
|
1150
|
-
* Set the
|
|
1151
|
-
*
|
|
1152
|
-
*
|
|
1097
|
+
* Set the event's busy status. Will add the
|
|
1098
|
+
* [`X-MICROSOFT-CDO-BUSYSTATUS`](https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/cd68eae7-ed65-4dd3-8ea7-ad585c76c736)
|
|
1099
|
+
* attribute to your event.
|
|
1153
1100
|
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1101
|
+
* ```javascript
|
|
1102
|
+
* import ical, {ICalEventBusyStatus} from 'ical-generator';
|
|
1103
|
+
* event.busystatus(ICalEventBusyStatus.BUSY);
|
|
1104
|
+
* ```
|
|
1105
|
+
*
|
|
1106
|
+
* @since 1.0.2
|
|
1156
1107
|
*/
|
|
1157
|
-
|
|
1108
|
+
busystatus(busystatus: ICalEventBusyStatus | null): this;
|
|
1158
1109
|
/**
|
|
1159
|
-
* Get
|
|
1160
|
-
* @since 0.
|
|
1110
|
+
* Get all categories
|
|
1111
|
+
* @since 0.3.0
|
|
1161
1112
|
*/
|
|
1162
|
-
|
|
1113
|
+
categories(): ICalCategory[];
|
|
1163
1114
|
/**
|
|
1164
|
-
*
|
|
1115
|
+
* Add categories to the event or return all selected categories.
|
|
1165
1116
|
*
|
|
1166
1117
|
* ```javascript
|
|
1167
|
-
* event.
|
|
1168
|
-
* ```
|
|
1169
|
-
*
|
|
1170
|
-
* ```typescript
|
|
1171
|
-
* import ical from 'ical-generator';
|
|
1172
|
-
*
|
|
1173
|
-
* const cal = ical();
|
|
1174
|
-
*
|
|
1175
|
-
* cal.createEvent({
|
|
1176
|
-
* start: new Date('2020-01-01'),
|
|
1177
|
-
* summary: 'Very Important Day',
|
|
1178
|
-
* allDay: true
|
|
1179
|
-
* });
|
|
1118
|
+
* const event = ical().createEvent();
|
|
1180
1119
|
*
|
|
1181
|
-
* cal.
|
|
1182
|
-
*
|
|
1120
|
+
* cal.categories([
|
|
1121
|
+
* {name: 'APPOINTMENT'},
|
|
1122
|
+
* {name: 'MEETING'}
|
|
1123
|
+
* ]);
|
|
1183
1124
|
*
|
|
1184
|
-
*
|
|
1185
|
-
* BEGIN:VCALENDAR
|
|
1186
|
-
* VERSION:2.0
|
|
1187
|
-
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1188
|
-
* BEGIN:VEVENT
|
|
1189
|
-
* UID:1964fe8d-32c5-4f2a-bd62-7d9d7de5992b
|
|
1190
|
-
* SEQUENCE:0
|
|
1191
|
-
* DTSTAMP:20240212T191956Z
|
|
1192
|
-
* DTSTART;VALUE=DATE:20200101
|
|
1193
|
-
* X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
|
|
1194
|
-
* X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE
|
|
1195
|
-
* SUMMARY:Very Important Day
|
|
1196
|
-
* END:VEVENT
|
|
1197
|
-
* END:VCALENDAR
|
|
1125
|
+
* cal.categories(); // --> [ICalCategory, ICalCategory]
|
|
1198
1126
|
* ```
|
|
1199
1127
|
*
|
|
1200
|
-
* @since 0.
|
|
1128
|
+
* @since 0.3.0
|
|
1201
1129
|
*/
|
|
1202
|
-
|
|
1130
|
+
categories(categories: (ICalCategory | ICalCategoryData)[]): this;
|
|
1203
1131
|
/**
|
|
1204
|
-
* Get the event's
|
|
1205
|
-
* @since
|
|
1132
|
+
* Get the event's class
|
|
1133
|
+
* @since 2.0.0
|
|
1206
1134
|
*/
|
|
1207
|
-
|
|
1208
|
-
floating(floating: boolean): this;
|
|
1135
|
+
class(): ICalEventClass | null;
|
|
1209
1136
|
/**
|
|
1210
|
-
*
|
|
1211
|
-
*
|
|
1137
|
+
* Set the event's class
|
|
1138
|
+
*
|
|
1139
|
+
* ```javascript
|
|
1140
|
+
* import ical, { ICalEventClass } from 'ical-generator';
|
|
1141
|
+
* event.class(ICalEventClass.PRIVATE);
|
|
1142
|
+
* ```
|
|
1143
|
+
*
|
|
1144
|
+
* @since 2.0.0
|
|
1212
1145
|
*/
|
|
1213
|
-
|
|
1146
|
+
class(class_: ICalEventClass | null): this;
|
|
1214
1147
|
/**
|
|
1215
|
-
*
|
|
1148
|
+
* Creates a new {@link ICalAlarm} and returns it. Use options to prefill
|
|
1149
|
+
* the alarm's attributes. Calling this method without options will create
|
|
1150
|
+
* an empty alarm.
|
|
1216
1151
|
*
|
|
1217
1152
|
* ```javascript
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
1226
|
-
* bySetPos: 3, // repeat every 3rd sunday (will take the first element of the byDay array)
|
|
1227
|
-
* exclude: [new Date('Dec 25 2013 00:00:00 UTC')], // exclude these dates
|
|
1228
|
-
* excludeTimezone: 'Europe/Berlin', // timezone of exclude
|
|
1229
|
-
* wkst: 'SU' // Start the week on Sunday, default is Monday
|
|
1153
|
+
* const cal = ical();
|
|
1154
|
+
* const event = cal.createEvent();
|
|
1155
|
+
* const alarm = event.createAlarm({type: ICalAlarmType.display, trigger: 300});
|
|
1156
|
+
*
|
|
1157
|
+
* // add another alarm
|
|
1158
|
+
* event.createAlarm({
|
|
1159
|
+
* type: ICalAlarmType.audio,
|
|
1160
|
+
* trigger: 300, // 5min before event
|
|
1230
1161
|
* });
|
|
1231
1162
|
* ```
|
|
1232
1163
|
*
|
|
1233
|
-
*
|
|
1164
|
+
* @since 0.2.1
|
|
1165
|
+
*/
|
|
1166
|
+
createAlarm(data: ICalAlarm | ICalAlarmData): ICalAlarm;
|
|
1167
|
+
/**
|
|
1168
|
+
* Adds an attachment to the event by adding the file URL to the calendar.
|
|
1234
1169
|
*
|
|
1235
|
-
|
|
1236
|
-
*
|
|
1170
|
+
* `ical-generator` only supports external attachments. File attachments that
|
|
1171
|
+
* are directly included in the file are not supported, because otherwise the
|
|
1172
|
+
* calendar file could easily become unfavourably large.
|
|
1237
1173
|
*
|
|
1174
|
+
* ```javascript
|
|
1238
1175
|
* const cal = ical();
|
|
1176
|
+
* const event = cal.createEvent();
|
|
1177
|
+
* event.createAttachment('https://files.sebbo.net/calendar/attachments/foo');
|
|
1178
|
+
* ```
|
|
1179
|
+
*
|
|
1180
|
+
* @since 3.2.0-develop.1
|
|
1181
|
+
*/
|
|
1182
|
+
createAttachment(url: string): this;
|
|
1183
|
+
/**
|
|
1184
|
+
* Creates a new {@link ICalAttendee} and returns it. Use options to prefill
|
|
1185
|
+
* the attendee's attributes. Calling this method without options will create
|
|
1186
|
+
* an empty attendee.
|
|
1187
|
+
*
|
|
1188
|
+
* ```javascript
|
|
1189
|
+
* import ical from 'ical-generator';
|
|
1239
1190
|
*
|
|
1191
|
+
* const cal = ical();
|
|
1240
1192
|
* const event = cal.createEvent({
|
|
1241
|
-
* start: new Date(
|
|
1242
|
-
* summary: 'Repeating Event'
|
|
1243
|
-
* });
|
|
1244
|
-
* event.repeating({
|
|
1245
|
-
* freq: ICalEventRepeatingFreq.WEEKLY,
|
|
1246
|
-
* count: 4
|
|
1193
|
+
* start: new Date()
|
|
1247
1194
|
* });
|
|
1248
1195
|
*
|
|
1249
|
-
*
|
|
1196
|
+
* event.createAttendee({email: 'hui@example.com', name: 'Hui'});
|
|
1197
|
+
*
|
|
1198
|
+
* // add another attendee
|
|
1199
|
+
* event.createAttendee('Buh <buh@example.net>');
|
|
1250
1200
|
* ```
|
|
1251
1201
|
*
|
|
1252
1202
|
* ```text
|
|
@@ -1254,83 +1204,126 @@ declare class ICalEvent {
|
|
|
1254
1204
|
* VERSION:2.0
|
|
1255
1205
|
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1256
1206
|
* BEGIN:VEVENT
|
|
1257
|
-
* UID:
|
|
1207
|
+
* UID:b4944f07-98e4-4581-ac80-2589bb20273d
|
|
1258
1208
|
* SEQUENCE:0
|
|
1259
|
-
* DTSTAMP:
|
|
1260
|
-
* DTSTART:
|
|
1261
|
-
*
|
|
1262
|
-
*
|
|
1209
|
+
* DTSTAMP:20240212T194232Z
|
|
1210
|
+
* DTSTART:20240212T194232Z
|
|
1211
|
+
* SUMMARY:
|
|
1212
|
+
* ATTENDEE;ROLE=REQ-PARTICIPANT;CN="Hui":MAILTO:hui@example.com
|
|
1213
|
+
* ATTENDEE;ROLE=REQ-PARTICIPANT;CN="Buh":MAILTO:buh@example.net
|
|
1263
1214
|
* END:VEVENT
|
|
1264
1215
|
* END:VCALENDAR
|
|
1265
1216
|
* ```
|
|
1266
1217
|
*
|
|
1218
|
+
* As with the organizer, you can also add an explicit `mailto` address.
|
|
1219
|
+
*
|
|
1220
|
+
* ```javascript
|
|
1221
|
+
* event.createAttendee({email: 'hui@example.com', name: 'Hui', mailto: 'another@mailto.com'});
|
|
1222
|
+
*
|
|
1223
|
+
* // overwrite an attendee's mailto address
|
|
1224
|
+
* attendee.mailto('another@mailto.net');
|
|
1225
|
+
* ```
|
|
1226
|
+
*
|
|
1267
1227
|
* @since 0.2.0
|
|
1268
1228
|
*/
|
|
1269
|
-
|
|
1229
|
+
createAttendee(data: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
1270
1230
|
/**
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1274
|
-
* ```typescript
|
|
1275
|
-
* import ical from 'ical-generator';
|
|
1276
|
-
* import { datetime, RRule } from 'rrule';
|
|
1231
|
+
* Creates a new {@link ICalCategory} and returns it. Use options to prefill the category's attributes.
|
|
1232
|
+
* Calling this method without options will create an empty category.
|
|
1277
1233
|
*
|
|
1234
|
+
* ```javascript
|
|
1278
1235
|
* const cal = ical();
|
|
1236
|
+
* const event = cal.createEvent();
|
|
1237
|
+
* const category = event.createCategory({name: 'APPOINTMENT'});
|
|
1279
1238
|
*
|
|
1280
|
-
*
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1239
|
+
* // add another category
|
|
1240
|
+
* event.createCategory({
|
|
1241
|
+
* name: 'MEETING'
|
|
1283
1242
|
* });
|
|
1243
|
+
* ```
|
|
1284
1244
|
*
|
|
1285
|
-
*
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1291
|
-
|
|
1292
|
-
|
|
1245
|
+
* @since 0.3.0
|
|
1246
|
+
*/
|
|
1247
|
+
createCategory(data: ICalCategory | ICalCategoryData): ICalCategory;
|
|
1248
|
+
/**
|
|
1249
|
+
* Get the event's creation date
|
|
1250
|
+
* @since 0.3.0
|
|
1251
|
+
*/
|
|
1252
|
+
created(): ICalDateTimeValue | null;
|
|
1253
|
+
/**
|
|
1254
|
+
* Set the event's creation date
|
|
1255
|
+
* @since 0.3.0
|
|
1256
|
+
*/
|
|
1257
|
+
created(created: ICalDateTimeValue | null): this;
|
|
1258
|
+
/**
|
|
1259
|
+
* Get the event's description as an {@link ICalDescription} object.
|
|
1260
|
+
* @since 0.2.0
|
|
1261
|
+
*/
|
|
1262
|
+
description(): ICalDescription | null;
|
|
1263
|
+
/**
|
|
1264
|
+
* Set the events description by passing a plaintext string or
|
|
1265
|
+
* an object containing both a plaintext and a html description.
|
|
1266
|
+
* Only a few calendar apps support html descriptions and like in
|
|
1267
|
+
* emails, supported HTML tags and styling is limited.
|
|
1293
1268
|
*
|
|
1294
|
-
*
|
|
1269
|
+
* ```javascript
|
|
1270
|
+
* event.description({
|
|
1271
|
+
* plain: 'Hello World!',
|
|
1272
|
+
* html: '<p>Hello World!</p>'
|
|
1273
|
+
* });
|
|
1295
1274
|
* ```
|
|
1296
1275
|
*
|
|
1297
1276
|
* ```text
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1300
|
-
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1301
|
-
* BEGIN:VEVENT
|
|
1302
|
-
* UID:36585e40-8fa8-460d-af0c-88b6f434030b
|
|
1303
|
-
* SEQUENCE:0
|
|
1304
|
-
* DTSTAMP:20240212T193827Z
|
|
1305
|
-
* DTSTART:20200101T200000Z
|
|
1306
|
-
* RRULE:FREQ=WEEKLY;INTERVAL=5;BYDAY=MO,FR;UNTIL=20121231T000000Z
|
|
1307
|
-
* SUMMARY:Repeating Event
|
|
1308
|
-
* END:VEVENT
|
|
1309
|
-
* END:VCALENDAR
|
|
1277
|
+
* DESCRIPTION:Hello World!
|
|
1278
|
+
* X-ALT-DESC;FMTTYPE=text/html:<p>Hello World!</p>
|
|
1310
1279
|
* ```
|
|
1280
|
+
*
|
|
1281
|
+
* @since 0.2.0
|
|
1311
1282
|
*/
|
|
1312
|
-
|
|
1283
|
+
description(description: ICalDescription | null | string): this;
|
|
1313
1284
|
/**
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1285
|
+
* Get the event end time which is currently
|
|
1286
|
+
* set. Can be any supported date object.
|
|
1287
|
+
*
|
|
1288
|
+
* @since 0.2.0
|
|
1316
1289
|
*/
|
|
1317
|
-
|
|
1290
|
+
end(): ICalDateTimeValue | null;
|
|
1318
1291
|
/**
|
|
1319
|
-
*
|
|
1292
|
+
* Set the appointment date of end. You can use any supported date object, see
|
|
1293
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1294
|
+
* for details about supported values and timezone handling.
|
|
1295
|
+
*
|
|
1296
|
+
* @since 0.2.0
|
|
1320
1297
|
*/
|
|
1321
|
-
|
|
1298
|
+
end(end: ICalDateTimeValue | null): this;
|
|
1322
1299
|
/**
|
|
1323
|
-
* Get the event's
|
|
1300
|
+
* Get the event's floating flag.
|
|
1324
1301
|
* @since 0.2.0
|
|
1325
1302
|
*/
|
|
1326
|
-
|
|
1303
|
+
floating(): boolean;
|
|
1304
|
+
floating(floating: boolean): this;
|
|
1327
1305
|
/**
|
|
1328
|
-
*
|
|
1329
|
-
* Defaults to an empty string if nothing is set.
|
|
1330
|
-
*
|
|
1306
|
+
* Get the event's ID
|
|
1331
1307
|
* @since 0.2.0
|
|
1332
1308
|
*/
|
|
1333
|
-
|
|
1309
|
+
id(): string;
|
|
1310
|
+
/**
|
|
1311
|
+
* Use this method to set the event's ID.
|
|
1312
|
+
* If not set, a UUID will be generated randomly.
|
|
1313
|
+
*
|
|
1314
|
+
* @param id Event ID you want to set
|
|
1315
|
+
*/
|
|
1316
|
+
id(id: number | string): this;
|
|
1317
|
+
/**
|
|
1318
|
+
* Get the event's last modification date
|
|
1319
|
+
* @since 0.3.0
|
|
1320
|
+
*/
|
|
1321
|
+
lastModified(): ICalDateTimeValue | null;
|
|
1322
|
+
/**
|
|
1323
|
+
* Set the event's last modification date
|
|
1324
|
+
* @since 0.3.0
|
|
1325
|
+
*/
|
|
1326
|
+
lastModified(lastModified: ICalDateTimeValue | null): this;
|
|
1334
1327
|
/**
|
|
1335
1328
|
* Get the event's location
|
|
1336
1329
|
* @since 0.2.0
|
|
@@ -1380,83 +1373,155 @@ declare class ICalEvent {
|
|
|
1380
1373
|
*
|
|
1381
1374
|
* @since 0.2.0
|
|
1382
1375
|
*/
|
|
1383
|
-
location(location: ICalLocation |
|
|
1376
|
+
location(location: ICalLocation | null | string): this;
|
|
1384
1377
|
/**
|
|
1385
|
-
* Get the event's
|
|
1378
|
+
* Get the event's organizer
|
|
1386
1379
|
* @since 0.2.0
|
|
1387
1380
|
*/
|
|
1388
|
-
|
|
1381
|
+
organizer(): ICalOrganizer | null;
|
|
1389
1382
|
/**
|
|
1390
|
-
* Set the
|
|
1391
|
-
* an object containing both a plaintext and a html description.
|
|
1392
|
-
* Only a few calendar apps support html descriptions and like in
|
|
1393
|
-
* emails, supported HTML tags and styling is limited.
|
|
1383
|
+
* Set the event's organizer
|
|
1394
1384
|
*
|
|
1395
1385
|
* ```javascript
|
|
1396
|
-
* event.
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1386
|
+
* event.organizer({
|
|
1387
|
+
* name: 'Organizer\'s Name',
|
|
1388
|
+
* email: 'organizer@example.com'
|
|
1399
1389
|
* });
|
|
1390
|
+
*
|
|
1391
|
+
* // OR
|
|
1392
|
+
*
|
|
1393
|
+
* event.organizer('Organizer\'s Name <organizer@example.com>');
|
|
1400
1394
|
* ```
|
|
1401
1395
|
*
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1396
|
+
* You can also add an explicit `mailto` email address or or the sentBy address.
|
|
1397
|
+
*
|
|
1398
|
+
* ```javascript
|
|
1399
|
+
* event.organizer({
|
|
1400
|
+
* name: 'Organizer\'s Name',
|
|
1401
|
+
* email: 'organizer@example.com',
|
|
1402
|
+
* mailto: 'explicit@mailto.com',
|
|
1403
|
+
* sentBy: 'substitute@example.com'
|
|
1404
|
+
* })
|
|
1405
1405
|
* ```
|
|
1406
1406
|
*
|
|
1407
1407
|
* @since 0.2.0
|
|
1408
1408
|
*/
|
|
1409
|
-
|
|
1409
|
+
organizer(organizer: ICalOrganizer | null | string): this;
|
|
1410
|
+
/**
|
|
1411
|
+
* Get the event's priority. A value of 1 represents
|
|
1412
|
+
* the highest priority, 9 the lowest. 0 specifies an undefined
|
|
1413
|
+
* priority.
|
|
1414
|
+
*
|
|
1415
|
+
* @since v2.0.0-develop.7
|
|
1416
|
+
*/
|
|
1417
|
+
priority(): null | number;
|
|
1418
|
+
/**
|
|
1419
|
+
* Set the event's priority. A value of 1 represents
|
|
1420
|
+
* the highest priority, 9 the lowest. 0 specifies an undefined
|
|
1421
|
+
* priority.
|
|
1422
|
+
*
|
|
1423
|
+
* @since v2.0.0-develop.7
|
|
1424
|
+
*/
|
|
1425
|
+
priority(priority: null | number): this;
|
|
1426
|
+
/**
|
|
1427
|
+
* Get the event's recurrence id
|
|
1428
|
+
* @since 0.2.0
|
|
1429
|
+
*/
|
|
1430
|
+
recurrenceId(): ICalDateTimeValue | null;
|
|
1410
1431
|
/**
|
|
1411
|
-
*
|
|
1432
|
+
* Set the event's recurrence id. You can use any supported date object, see
|
|
1433
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1434
|
+
* for details about supported values and timezone handling.
|
|
1435
|
+
*
|
|
1412
1436
|
* @since 0.2.0
|
|
1413
1437
|
*/
|
|
1414
|
-
|
|
1438
|
+
recurrenceId(recurrenceId: ICalDateTimeValue | null): this;
|
|
1415
1439
|
/**
|
|
1416
|
-
*
|
|
1440
|
+
* Get the event's repeating options
|
|
1441
|
+
* @since 0.2.0
|
|
1442
|
+
*/
|
|
1443
|
+
repeating(): ICalEventJSONRepeatingData | ICalRRuleStub | null | string;
|
|
1444
|
+
/**
|
|
1445
|
+
* Set the event's repeating options by passing an {@link ICalRepeatingOptions} object.
|
|
1417
1446
|
*
|
|
1418
1447
|
* ```javascript
|
|
1419
|
-
* event.
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1448
|
+
* event.repeating({
|
|
1449
|
+
* freq: 'MONTHLY', // required
|
|
1450
|
+
* count: 5,
|
|
1451
|
+
* interval: 2,
|
|
1452
|
+
* until: new Date('Jan 01 2014 00:00:00 UTC'),
|
|
1453
|
+
* byDay: ['su', 'mo'], // repeat only sunday and monday
|
|
1454
|
+
* byMonth: [1, 2], // repeat only in january and february,
|
|
1455
|
+
* byMonthDay: [1, 15], // repeat only on the 1st and 15th
|
|
1456
|
+
* bySetPos: 3, // repeat every 3rd sunday (will take the first element of the byDay array)
|
|
1457
|
+
* exclude: [new Date('Dec 25 2013 00:00:00 UTC')], // exclude these dates
|
|
1458
|
+
* excludeTimezone: 'Europe/Berlin', // timezone of exclude
|
|
1459
|
+
* wkst: 'SU' // Start the week on Sunday, default is Monday
|
|
1422
1460
|
* });
|
|
1461
|
+
* ```
|
|
1423
1462
|
*
|
|
1424
|
-
*
|
|
1463
|
+
* **Example:**
|
|
1425
1464
|
*
|
|
1426
|
-
|
|
1427
|
-
*
|
|
1465
|
+
*```typescript
|
|
1466
|
+
* import ical, { ICalEventRepeatingFreq } from 'ical-generator';
|
|
1428
1467
|
*
|
|
1429
|
-
*
|
|
1468
|
+
* const cal = ical();
|
|
1430
1469
|
*
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
1433
|
-
*
|
|
1434
|
-
*
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1470
|
+
* const event = cal.createEvent({
|
|
1471
|
+
* start: new Date('2020-01-01T20:00:00Z'),
|
|
1472
|
+
* summary: 'Repeating Event'
|
|
1473
|
+
* });
|
|
1474
|
+
* event.repeating({
|
|
1475
|
+
* freq: ICalEventRepeatingFreq.WEEKLY,
|
|
1476
|
+
* count: 4
|
|
1477
|
+
* });
|
|
1478
|
+
*
|
|
1479
|
+
* cal.toString();
|
|
1480
|
+
* ```
|
|
1481
|
+
*
|
|
1482
|
+
* ```text
|
|
1483
|
+
* BEGIN:VCALENDAR
|
|
1484
|
+
* VERSION:2.0
|
|
1485
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1486
|
+
* BEGIN:VEVENT
|
|
1487
|
+
* UID:b80e6a68-c2cd-48f5-b94d-cecc7ce83871
|
|
1488
|
+
* SEQUENCE:0
|
|
1489
|
+
* DTSTAMP:20240212T193646Z
|
|
1490
|
+
* DTSTART:20200101T200000Z
|
|
1491
|
+
* RRULE:FREQ=WEEKLY;COUNT=4
|
|
1492
|
+
* SUMMARY:Repeating Event
|
|
1493
|
+
* END:VEVENT
|
|
1494
|
+
* END:VCALENDAR
|
|
1438
1495
|
* ```
|
|
1439
1496
|
*
|
|
1440
1497
|
* @since 0.2.0
|
|
1441
1498
|
*/
|
|
1442
|
-
|
|
1499
|
+
repeating(repeating: ICalRepeatingOptions | null): this;
|
|
1443
1500
|
/**
|
|
1444
|
-
*
|
|
1445
|
-
*
|
|
1446
|
-
* an empty attendee.
|
|
1501
|
+
* Set the event's repeating options by passing an [RRule object](https://github.com/jakubroztocil/rrule).
|
|
1502
|
+
* @since 2.0.0-develop.5
|
|
1447
1503
|
*
|
|
1448
|
-
* ```
|
|
1504
|
+
* ```typescript
|
|
1449
1505
|
* import ical from 'ical-generator';
|
|
1506
|
+
* import { datetime, RRule } from 'rrule';
|
|
1450
1507
|
*
|
|
1451
1508
|
* const cal = ical();
|
|
1509
|
+
*
|
|
1452
1510
|
* const event = cal.createEvent({
|
|
1453
|
-
* start: new Date()
|
|
1511
|
+
* start: new Date('2020-01-01T20:00:00Z'),
|
|
1512
|
+
* summary: 'Repeating Event'
|
|
1454
1513
|
* });
|
|
1455
1514
|
*
|
|
1456
|
-
*
|
|
1515
|
+
* const rule = new RRule({
|
|
1516
|
+
* freq: RRule.WEEKLY,
|
|
1517
|
+
* interval: 5,
|
|
1518
|
+
* byweekday: [RRule.MO, RRule.FR],
|
|
1519
|
+
* dtstart: datetime(2012, 2, 1, 10, 30),
|
|
1520
|
+
* until: datetime(2012, 12, 31)
|
|
1521
|
+
* })
|
|
1522
|
+
* event.repeating(rule);
|
|
1457
1523
|
*
|
|
1458
|
-
*
|
|
1459
|
-
* event.createAttendee('Buh <buh@example.net>');
|
|
1524
|
+
* cal.toString();
|
|
1460
1525
|
* ```
|
|
1461
1526
|
*
|
|
1462
1527
|
* ```text
|
|
@@ -1464,133 +1529,101 @@ declare class ICalEvent {
|
|
|
1464
1529
|
* VERSION:2.0
|
|
1465
1530
|
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1466
1531
|
* BEGIN:VEVENT
|
|
1467
|
-
* UID:
|
|
1532
|
+
* UID:36585e40-8fa8-460d-af0c-88b6f434030b
|
|
1468
1533
|
* SEQUENCE:0
|
|
1469
|
-
* DTSTAMP:
|
|
1470
|
-
* DTSTART:
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
* ATTENDEE;ROLE=REQ-PARTICIPANT;CN="Buh":MAILTO:buh@example.net
|
|
1534
|
+
* DTSTAMP:20240212T193827Z
|
|
1535
|
+
* DTSTART:20200101T200000Z
|
|
1536
|
+
* RRULE:FREQ=WEEKLY;INTERVAL=5;BYDAY=MO,FR;UNTIL=20121231T000000Z
|
|
1537
|
+
* SUMMARY:Repeating Event
|
|
1474
1538
|
* END:VEVENT
|
|
1475
1539
|
* END:VCALENDAR
|
|
1476
1540
|
* ```
|
|
1477
|
-
*
|
|
1478
|
-
* As with the organizer, you can also add an explicit `mailto` address.
|
|
1479
|
-
*
|
|
1480
|
-
* ```javascript
|
|
1481
|
-
* event.createAttendee({email: 'hui@example.com', name: 'Hui', mailto: 'another@mailto.com'});
|
|
1482
|
-
*
|
|
1483
|
-
* // overwrite an attendee's mailto address
|
|
1484
|
-
* attendee.mailto('another@mailto.net');
|
|
1485
|
-
* ```
|
|
1486
|
-
*
|
|
1487
|
-
* @since 0.2.0
|
|
1488
1541
|
*/
|
|
1489
|
-
|
|
1542
|
+
repeating(repeating: ICalRRuleStub | null): this;
|
|
1490
1543
|
/**
|
|
1491
|
-
*
|
|
1492
|
-
* @since 0.
|
|
1544
|
+
* Set the events repeating options by passing a string which is inserted in the ical file.
|
|
1545
|
+
* @since 2.0.0-develop.5
|
|
1493
1546
|
*/
|
|
1494
|
-
|
|
1547
|
+
repeating(repeating: null | string): this;
|
|
1495
1548
|
/**
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1498
|
-
* ```javascript
|
|
1499
|
-
* const event = ical().createEvent();
|
|
1500
|
-
*
|
|
1501
|
-
* cal.attendees([
|
|
1502
|
-
* {email: 'a@example.com', name: 'Person A'},
|
|
1503
|
-
* {email: 'b@example.com', name: 'Person B'}
|
|
1504
|
-
* ]);
|
|
1505
|
-
*
|
|
1506
|
-
* cal.attendees(); // --> [ICalAttendee, ICalAttendee]
|
|
1507
|
-
* ```
|
|
1508
|
-
*
|
|
1509
|
-
* @since 0.2.0
|
|
1549
|
+
* @internal
|
|
1510
1550
|
*/
|
|
1511
|
-
|
|
1551
|
+
repeating(repeating: ICalRepeatingOptions | ICalRRuleStub | null | string): this;
|
|
1512
1552
|
/**
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1515
|
-
* an empty alarm.
|
|
1516
|
-
*
|
|
1517
|
-
* ```javascript
|
|
1518
|
-
* const cal = ical();
|
|
1519
|
-
* const event = cal.createEvent();
|
|
1520
|
-
* const alarm = event.createAlarm({type: ICalAlarmType.display, trigger: 300});
|
|
1553
|
+
* Get the event's SEQUENCE number. Use this method to get the event's
|
|
1554
|
+
* revision sequence number of the calendar component within a sequence of revisions.
|
|
1521
1555
|
*
|
|
1522
|
-
*
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
*
|
|
1527
|
-
*
|
|
1556
|
+
* @since 0.2.6
|
|
1557
|
+
*/
|
|
1558
|
+
sequence(): number;
|
|
1559
|
+
/**
|
|
1560
|
+
* Set the event's SEQUENCE number. For a new event, this should be zero.
|
|
1561
|
+
* Each time the organizer makes a significant revision, the sequence
|
|
1562
|
+
* number should be incremented.
|
|
1528
1563
|
*
|
|
1529
|
-
* @
|
|
1564
|
+
* @param sequence Sequence number or null to unset it
|
|
1530
1565
|
*/
|
|
1531
|
-
|
|
1566
|
+
sequence(sequence: number): this;
|
|
1532
1567
|
/**
|
|
1533
|
-
* Get
|
|
1568
|
+
* Get the event's timestamp
|
|
1534
1569
|
* @since 0.2.0
|
|
1570
|
+
* @see {@link timestamp}
|
|
1535
1571
|
*/
|
|
1536
|
-
|
|
1572
|
+
stamp(): ICalDateTimeValue;
|
|
1537
1573
|
/**
|
|
1538
|
-
*
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
* const event = ical().createEvent();
|
|
1542
|
-
*
|
|
1543
|
-
* cal.alarms([
|
|
1544
|
-
* {type: ICalAlarmType.display, trigger: 600},
|
|
1545
|
-
* {type: ICalAlarmType.audio, trigger: 300}
|
|
1546
|
-
* ]);
|
|
1574
|
+
* Set the appointment date of creation. Defaults to the current time and date (`new Date()`). You can use
|
|
1575
|
+
* any supported date object, see [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1576
|
+
* for details about supported values and timezone handling.
|
|
1547
1577
|
*
|
|
1548
|
-
*
|
|
1549
|
-
|
|
1578
|
+
* @since 0.2.0
|
|
1579
|
+
* @see {@link timestamp}
|
|
1580
|
+
*/
|
|
1581
|
+
stamp(stamp: ICalDateTimeValue): this;
|
|
1582
|
+
/**
|
|
1583
|
+
* Get the event start time which is currently
|
|
1584
|
+
* set. Can be any supported date object.
|
|
1550
1585
|
*
|
|
1551
1586
|
* @since 0.2.0
|
|
1552
1587
|
*/
|
|
1553
|
-
|
|
1588
|
+
start(): ICalDateTimeValue;
|
|
1554
1589
|
/**
|
|
1555
|
-
*
|
|
1556
|
-
*
|
|
1590
|
+
* Set the appointment date of beginning, which is required for all events.
|
|
1591
|
+
* You can use any supported date object, see
|
|
1592
|
+
* [Readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1593
|
+
* for details about supported values and timezone handling.
|
|
1594
|
+
*
|
|
1595
|
+
* ```typescript
|
|
1596
|
+
* import ical from 'ical-generator';
|
|
1557
1597
|
*
|
|
1558
|
-
* ```javascript
|
|
1559
1598
|
* const cal = ical();
|
|
1560
|
-
* const event = cal.createEvent();
|
|
1561
|
-
* const category = event.createCategory({name: 'APPOINTMENT'});
|
|
1562
1599
|
*
|
|
1563
|
-
*
|
|
1564
|
-
*
|
|
1565
|
-
* name: 'MEETING'
|
|
1600
|
+
* const event = cal.createEvent({
|
|
1601
|
+
* start: new Date('2020-01-01')
|
|
1566
1602
|
* });
|
|
1567
|
-
* ```
|
|
1568
|
-
*
|
|
1569
|
-
* @since 0.3.0
|
|
1570
|
-
*/
|
|
1571
|
-
createCategory(data: ICalCategory | ICalCategoryData): ICalCategory;
|
|
1572
|
-
/**
|
|
1573
|
-
* Get all categories
|
|
1574
|
-
* @since 0.3.0
|
|
1575
|
-
*/
|
|
1576
|
-
categories(): ICalCategory[];
|
|
1577
|
-
/**
|
|
1578
|
-
* Add categories to the event or return all selected categories.
|
|
1579
1603
|
*
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
1604
|
+
* // overwrites old start date
|
|
1605
|
+
* event.start(new Date('2024-02-01'));
|
|
1582
1606
|
*
|
|
1583
|
-
* cal.
|
|
1584
|
-
*
|
|
1585
|
-
* {name: 'MEETING'}
|
|
1586
|
-
* ]);
|
|
1607
|
+
* cal.toString();
|
|
1608
|
+
* ```
|
|
1587
1609
|
*
|
|
1588
|
-
*
|
|
1610
|
+
* ```text
|
|
1611
|
+
* BEGIN:VCALENDAR
|
|
1612
|
+
* VERSION:2.0
|
|
1613
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1614
|
+
* BEGIN:VEVENT
|
|
1615
|
+
* UID:7e2aee64-b07a-4256-9b3e-e9eaa452bac8
|
|
1616
|
+
* SEQUENCE:0
|
|
1617
|
+
* DTSTAMP:20240212T190915Z
|
|
1618
|
+
* DTSTART:20240201T000000Z
|
|
1619
|
+
* SUMMARY:
|
|
1620
|
+
* END:VEVENT
|
|
1621
|
+
* END:VCALENDAR
|
|
1589
1622
|
* ```
|
|
1590
1623
|
*
|
|
1591
|
-
* @since 0.
|
|
1624
|
+
* @since 0.2.0
|
|
1592
1625
|
*/
|
|
1593
|
-
|
|
1626
|
+
start(start: ICalDateTimeValue): this;
|
|
1594
1627
|
/**
|
|
1595
1628
|
* Get the event's status
|
|
1596
1629
|
* @since 0.2.0
|
|
@@ -1608,87 +1641,87 @@ declare class ICalEvent {
|
|
|
1608
1641
|
*/
|
|
1609
1642
|
status(status: ICalEventStatus | null): this;
|
|
1610
1643
|
/**
|
|
1611
|
-
* Get the event's
|
|
1612
|
-
* @since
|
|
1644
|
+
* Get the event's summary
|
|
1645
|
+
* @since 0.2.0
|
|
1613
1646
|
*/
|
|
1614
|
-
|
|
1647
|
+
summary(): string;
|
|
1615
1648
|
/**
|
|
1616
|
-
* Set the event's
|
|
1617
|
-
*
|
|
1618
|
-
* attribute to your event.
|
|
1619
|
-
*
|
|
1620
|
-
* ```javascript
|
|
1621
|
-
* import ical, {ICalEventBusyStatus} from 'ical-generator';
|
|
1622
|
-
* event.busystatus(ICalEventBusyStatus.BUSY);
|
|
1623
|
-
* ```
|
|
1649
|
+
* Set the event's summary.
|
|
1650
|
+
* Defaults to an empty string if nothing is set.
|
|
1624
1651
|
*
|
|
1625
|
-
* @since
|
|
1652
|
+
* @since 0.2.0
|
|
1626
1653
|
*/
|
|
1627
|
-
|
|
1654
|
+
summary(summary: string): this;
|
|
1628
1655
|
/**
|
|
1629
|
-
* Get the event's
|
|
1630
|
-
*
|
|
1631
|
-
*
|
|
1632
|
-
*
|
|
1633
|
-
* @since v2.0.0-develop.7
|
|
1656
|
+
* Get the event's timestamp
|
|
1657
|
+
* @since 0.2.0
|
|
1658
|
+
* @see {@link stamp}
|
|
1634
1659
|
*/
|
|
1635
|
-
|
|
1660
|
+
timestamp(): ICalDateTimeValue;
|
|
1636
1661
|
/**
|
|
1637
|
-
* Set the
|
|
1638
|
-
*
|
|
1639
|
-
*
|
|
1662
|
+
* Set the appointment date of creation. Defaults to the current time and date (`new Date()`). You can use
|
|
1663
|
+
* any supported date object, see [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
1664
|
+
* for details about supported values and timezone handling.
|
|
1640
1665
|
*
|
|
1641
|
-
* @since v2.0.0-develop.7
|
|
1642
|
-
*/
|
|
1643
|
-
priority(priority: number | null): this;
|
|
1644
|
-
/**
|
|
1645
|
-
* Get the event's URL
|
|
1646
1666
|
* @since 0.2.0
|
|
1667
|
+
* @see {@link stamp}
|
|
1647
1668
|
*/
|
|
1648
|
-
|
|
1669
|
+
timestamp(stamp: ICalDateTimeValue): this;
|
|
1649
1670
|
/**
|
|
1650
|
-
*
|
|
1651
|
-
* @since 0.2.
|
|
1671
|
+
* Get the event's timezone.
|
|
1672
|
+
* @since 0.2.6
|
|
1652
1673
|
*/
|
|
1653
|
-
|
|
1674
|
+
timezone(): null | string;
|
|
1654
1675
|
/**
|
|
1655
|
-
*
|
|
1676
|
+
* Sets the time zone to be used for this event. If a time zone has been
|
|
1677
|
+
* defined in both the event and the calendar, the time zone of the event
|
|
1678
|
+
* is used.
|
|
1656
1679
|
*
|
|
1657
|
-
*
|
|
1658
|
-
* are
|
|
1659
|
-
*
|
|
1680
|
+
* Please note that if the time zone is set, ical-generator assumes
|
|
1681
|
+
* that all times are already in the correct time zone. Alternatively,
|
|
1682
|
+
* a `moment-timezone` or a Luxon object can be passed with `setZone`,
|
|
1683
|
+
* ical-generator will then set the time zone itself.
|
|
1684
|
+
*
|
|
1685
|
+
* This and the 'floating' flag (see below) are mutually exclusive, and setting a timezone will unset the
|
|
1686
|
+
* 'floating' flag. If neither 'timezone' nor 'floating' are set, the date will be output with in UTC format
|
|
1687
|
+
* (see [date-time form #2 in section 3.3.5 of RFC 554](https://tools.ietf.org/html/rfc5545#section-3.3.5)).
|
|
1688
|
+
*
|
|
1689
|
+
* See [Readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones) for details about
|
|
1690
|
+
* supported values and timezone handling.
|
|
1660
1691
|
*
|
|
1661
1692
|
* ```javascript
|
|
1662
|
-
*
|
|
1663
|
-
* const event = cal.createEvent();
|
|
1664
|
-
* event.createAttachment('https://files.sebbo.net/calendar/attachments/foo');
|
|
1693
|
+
* event.timezone('America/New_York');
|
|
1665
1694
|
* ```
|
|
1666
1695
|
*
|
|
1667
|
-
* @
|
|
1668
|
-
|
|
1669
|
-
createAttachment(url: string): this;
|
|
1670
|
-
/**
|
|
1671
|
-
* Get all attachment urls
|
|
1672
|
-
* @since 3.2.0-develop.1
|
|
1696
|
+
* @see https://github.com/sebbo2002/ical-generator#-date-time--timezones
|
|
1697
|
+
* @since 0.2.6
|
|
1673
1698
|
*/
|
|
1674
|
-
|
|
1699
|
+
timezone(timezone: null | string): this;
|
|
1675
1700
|
/**
|
|
1676
|
-
*
|
|
1701
|
+
* Return a shallow copy of the events's options for JSON stringification.
|
|
1702
|
+
* Third party objects like moment.js values or RRule objects are stringified
|
|
1703
|
+
* as well. Can be used for persistence.
|
|
1677
1704
|
*
|
|
1678
1705
|
* ```javascript
|
|
1679
1706
|
* const event = ical().createEvent();
|
|
1707
|
+
* const json = JSON.stringify(event);
|
|
1680
1708
|
*
|
|
1681
|
-
*
|
|
1682
|
-
*
|
|
1683
|
-
*
|
|
1684
|
-
* ]);
|
|
1709
|
+
* // later: restore event data
|
|
1710
|
+
* const calendar = ical().createEvent(JSON.parse(json));
|
|
1711
|
+
* ```
|
|
1685
1712
|
*
|
|
1686
|
-
*
|
|
1687
|
-
|
|
1713
|
+
* @since 0.2.4
|
|
1714
|
+
*/
|
|
1715
|
+
toJSON(): ICalEventJSONData;
|
|
1716
|
+
/**
|
|
1717
|
+
* Return generated event as a string.
|
|
1688
1718
|
*
|
|
1689
|
-
*
|
|
1719
|
+
* ```javascript
|
|
1720
|
+
* const event = ical().createEvent();
|
|
1721
|
+
* console.log(event.toString()); // → BEGIN:VEVENT…
|
|
1722
|
+
* ```
|
|
1690
1723
|
*/
|
|
1691
|
-
|
|
1724
|
+
toString(): string;
|
|
1692
1725
|
/**
|
|
1693
1726
|
* Get the event's transparency
|
|
1694
1727
|
* @since 1.7.3
|
|
@@ -1712,41 +1745,28 @@ declare class ICalEvent {
|
|
|
1712
1745
|
*/
|
|
1713
1746
|
transparency(transparency: ICalEventTransparency | null): this;
|
|
1714
1747
|
/**
|
|
1715
|
-
* Get the event's
|
|
1716
|
-
* @since 0.
|
|
1717
|
-
|
|
1718
|
-
created(): ICalDateTimeValue | null;
|
|
1719
|
-
/**
|
|
1720
|
-
* Set the event's creation date
|
|
1721
|
-
* @since 0.3.0
|
|
1722
|
-
*/
|
|
1723
|
-
created(created: ICalDateTimeValue | null): this;
|
|
1724
|
-
/**
|
|
1725
|
-
* Get the event's last modification date
|
|
1726
|
-
* @since 0.3.0
|
|
1748
|
+
* Get the event's ID
|
|
1749
|
+
* @since 0.2.0
|
|
1750
|
+
* @see {@link id}
|
|
1727
1751
|
*/
|
|
1728
|
-
|
|
1752
|
+
uid(): string;
|
|
1729
1753
|
/**
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
1754
|
+
* Use this method to set the event's ID.
|
|
1755
|
+
* If not set, a UUID will be generated randomly.
|
|
1756
|
+
*
|
|
1757
|
+
* @param id Event ID you want to set
|
|
1732
1758
|
*/
|
|
1733
|
-
|
|
1759
|
+
uid(id: number | string): this;
|
|
1734
1760
|
/**
|
|
1735
|
-
* Get the event's
|
|
1736
|
-
* @since 2.0
|
|
1761
|
+
* Get the event's URL
|
|
1762
|
+
* @since 0.2.0
|
|
1737
1763
|
*/
|
|
1738
|
-
|
|
1764
|
+
url(): null | string;
|
|
1739
1765
|
/**
|
|
1740
|
-
* Set the event's
|
|
1741
|
-
*
|
|
1742
|
-
* ```javascript
|
|
1743
|
-
* import ical, { ICalEventClass } from 'ical-generator';
|
|
1744
|
-
* event.class(ICalEventClass.PRIVATE);
|
|
1745
|
-
* ```
|
|
1746
|
-
*
|
|
1747
|
-
* @since 2.0.0
|
|
1766
|
+
* Set the event's URL
|
|
1767
|
+
* @since 0.2.0
|
|
1748
1768
|
*/
|
|
1749
|
-
|
|
1769
|
+
url(url: null | string): this;
|
|
1750
1770
|
/**
|
|
1751
1771
|
* Set X-* attributes. Woun't filter double attributes,
|
|
1752
1772
|
* which are also added by another method (e.g. summary),
|
|
@@ -1771,10 +1791,10 @@ declare class ICalEvent {
|
|
|
1771
1791
|
*
|
|
1772
1792
|
* @since 1.9.0
|
|
1773
1793
|
*/
|
|
1774
|
-
x(keyOrArray: {
|
|
1794
|
+
x(keyOrArray: [string, string][] | Record<string, string> | {
|
|
1775
1795
|
key: string;
|
|
1776
1796
|
value: string;
|
|
1777
|
-
}[]
|
|
1797
|
+
}[]): this;
|
|
1778
1798
|
/**
|
|
1779
1799
|
* Set a X-* attribute. Woun't filter double attributes,
|
|
1780
1800
|
* which are also added by another method (e.g. summary),
|
|
@@ -1796,59 +1816,49 @@ declare class ICalEvent {
|
|
|
1796
1816
|
value: string;
|
|
1797
1817
|
}[];
|
|
1798
1818
|
/**
|
|
1799
|
-
*
|
|
1800
|
-
*
|
|
1801
|
-
* as well. Can be used for persistence.
|
|
1802
|
-
*
|
|
1803
|
-
* ```javascript
|
|
1804
|
-
* const event = ical().createEvent();
|
|
1805
|
-
* const json = JSON.stringify(event);
|
|
1806
|
-
*
|
|
1807
|
-
* // later: restore event data
|
|
1808
|
-
* const calendar = ical().createEvent(JSON.parse(json));
|
|
1809
|
-
* ```
|
|
1810
|
-
*
|
|
1811
|
-
* @since 0.2.4
|
|
1812
|
-
*/
|
|
1813
|
-
toJSON(): ICalEventJSONData;
|
|
1814
|
-
/**
|
|
1815
|
-
* Return generated event as a string.
|
|
1816
|
-
*
|
|
1817
|
-
* ```javascript
|
|
1818
|
-
* const event = ical().createEvent();
|
|
1819
|
-
* console.log(event.toString()); // → BEGIN:VEVENT…
|
|
1820
|
-
* ```
|
|
1819
|
+
* Checks if the start date is after the end date and swaps them if necessary.
|
|
1820
|
+
* @private
|
|
1821
1821
|
*/
|
|
1822
|
-
|
|
1822
|
+
private swapStartAndEndIfRequired;
|
|
1823
1823
|
}
|
|
1824
1824
|
|
|
1825
|
+
declare enum ICalCalendarMethod {
|
|
1826
|
+
ADD = "ADD",
|
|
1827
|
+
CANCEL = "CANCEL",
|
|
1828
|
+
COUNTER = "COUNTER",
|
|
1829
|
+
DECLINECOUNTER = "DECLINECOUNTER",
|
|
1830
|
+
PUBLISH = "PUBLISH",
|
|
1831
|
+
REFRESH = "REFRESH",
|
|
1832
|
+
REPLY = "REPLY",
|
|
1833
|
+
REQUEST = "REQUEST"
|
|
1834
|
+
}
|
|
1825
1835
|
interface ICalCalendarData {
|
|
1826
|
-
|
|
1827
|
-
method?: ICalCalendarMethod | null;
|
|
1828
|
-
name?: string | null;
|
|
1829
|
-
description?: string | null;
|
|
1830
|
-
timezone?: ICalTimezone | string | null;
|
|
1831
|
-
source?: string | null;
|
|
1832
|
-
url?: string | null;
|
|
1833
|
-
scale?: string | null;
|
|
1834
|
-
ttl?: number | ICalMomentDurationStub | null;
|
|
1836
|
+
description?: null | string;
|
|
1835
1837
|
events?: (ICalEvent | ICalEventData)[];
|
|
1836
|
-
|
|
1838
|
+
method?: ICalCalendarMethod | null;
|
|
1839
|
+
name?: null | string;
|
|
1840
|
+
prodId?: ICalCalendarProdIdData | string;
|
|
1841
|
+
scale?: null | string;
|
|
1842
|
+
source?: null | string;
|
|
1843
|
+
timezone?: ICalTimezone | null | string;
|
|
1844
|
+
ttl?: ICalMomentDurationStub | null | number;
|
|
1845
|
+
url?: null | string;
|
|
1846
|
+
x?: [string, string][] | Record<string, string> | {
|
|
1837
1847
|
key: string;
|
|
1838
1848
|
value: string;
|
|
1839
|
-
}[]
|
|
1849
|
+
}[];
|
|
1840
1850
|
}
|
|
1841
1851
|
interface ICalCalendarJSONData {
|
|
1842
|
-
|
|
1843
|
-
method: ICalCalendarMethod | null;
|
|
1844
|
-
name: string | null;
|
|
1845
|
-
description: string | null;
|
|
1846
|
-
timezone: string | null;
|
|
1847
|
-
source: string | null;
|
|
1848
|
-
url: string | null;
|
|
1849
|
-
scale: string | null;
|
|
1850
|
-
ttl: number | null;
|
|
1852
|
+
description: null | string;
|
|
1851
1853
|
events: ICalEventJSONData[];
|
|
1854
|
+
method: ICalCalendarMethod | null;
|
|
1855
|
+
name: null | string;
|
|
1856
|
+
prodId: string;
|
|
1857
|
+
scale: null | string;
|
|
1858
|
+
source: null | string;
|
|
1859
|
+
timezone: null | string;
|
|
1860
|
+
ttl: null | number;
|
|
1861
|
+
url: null | string;
|
|
1852
1862
|
x: {
|
|
1853
1863
|
key: string;
|
|
1854
1864
|
value: string;
|
|
@@ -1856,18 +1866,8 @@ interface ICalCalendarJSONData {
|
|
|
1856
1866
|
}
|
|
1857
1867
|
interface ICalCalendarProdIdData {
|
|
1858
1868
|
company: string;
|
|
1859
|
-
product: string;
|
|
1860
1869
|
language?: string;
|
|
1861
|
-
|
|
1862
|
-
declare enum ICalCalendarMethod {
|
|
1863
|
-
PUBLISH = "PUBLISH",
|
|
1864
|
-
REQUEST = "REQUEST",
|
|
1865
|
-
REPLY = "REPLY",
|
|
1866
|
-
ADD = "ADD",
|
|
1867
|
-
CANCEL = "CANCEL",
|
|
1868
|
-
REFRESH = "REFRESH",
|
|
1869
|
-
COUNTER = "COUNTER",
|
|
1870
|
-
DECLINECOUNTER = "DECLINECOUNTER"
|
|
1870
|
+
product: string;
|
|
1871
1871
|
}
|
|
1872
1872
|
/**
|
|
1873
1873
|
* Usually you get an {@link ICalCalendar} object like this:
|
|
@@ -1920,32 +1920,90 @@ declare class ICalCalendar {
|
|
|
1920
1920
|
*/
|
|
1921
1921
|
constructor(data?: ICalCalendarData);
|
|
1922
1922
|
/**
|
|
1923
|
-
*
|
|
1923
|
+
* Remove all events from the calendar without
|
|
1924
|
+
* touching any other data like name or prodId.
|
|
1925
|
+
*
|
|
1926
|
+
* @since 2.0.0-develop.1
|
|
1927
|
+
*/
|
|
1928
|
+
clear(): this;
|
|
1929
|
+
/**
|
|
1930
|
+
* Creates a new {@link ICalEvent} and returns it. Use options to prefill the event's attributes.
|
|
1931
|
+
* Calling this method without options will create an empty event.
|
|
1932
|
+
*
|
|
1933
|
+
* ```javascript
|
|
1934
|
+
* import ical from 'ical-generator';
|
|
1935
|
+
*
|
|
1936
|
+
* // or use require:
|
|
1937
|
+
* // const { default: ical } = require('ical-generator');
|
|
1938
|
+
*
|
|
1939
|
+
* const cal = ical();
|
|
1940
|
+
* const event = cal.createEvent({summary: 'My Event'});
|
|
1941
|
+
*
|
|
1942
|
+
* // overwrite event summary
|
|
1943
|
+
* event.summary('Your Event');
|
|
1944
|
+
* ```
|
|
1945
|
+
*
|
|
1924
1946
|
* @since 0.2.0
|
|
1925
1947
|
*/
|
|
1926
|
-
|
|
1948
|
+
createEvent(data: ICalEvent | ICalEventData): ICalEvent;
|
|
1927
1949
|
/**
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
|
|
1931
|
-
|
|
1950
|
+
* Get your feed's description
|
|
1951
|
+
* @since 0.2.7
|
|
1952
|
+
*/
|
|
1953
|
+
description(): null | string;
|
|
1954
|
+
/**
|
|
1955
|
+
* Set your feed's description
|
|
1956
|
+
* @since 0.2.7
|
|
1957
|
+
*/
|
|
1958
|
+
description(description: null | string): this;
|
|
1959
|
+
/**
|
|
1960
|
+
* Returns all events of this calendar.
|
|
1961
|
+
*
|
|
1962
|
+
* ```javascript
|
|
1963
|
+
* const cal = ical();
|
|
1964
|
+
*
|
|
1965
|
+
* cal.events([
|
|
1966
|
+
* {
|
|
1967
|
+
* start: new Date(),
|
|
1968
|
+
* end: new Date(new Date().getTime() + 3600000),
|
|
1969
|
+
* summary: 'Example Event',
|
|
1970
|
+
* description: 'It works ;)',
|
|
1971
|
+
* url: 'http://sebbo.net/'
|
|
1972
|
+
* }
|
|
1973
|
+
* ]);
|
|
1974
|
+
*
|
|
1975
|
+
* cal.events(); // --> [ICalEvent]
|
|
1976
|
+
* ```
|
|
1977
|
+
*
|
|
1978
|
+
* @since 0.2.0
|
|
1979
|
+
*/
|
|
1980
|
+
events(): ICalEvent[];
|
|
1981
|
+
/**
|
|
1982
|
+
* Add multiple events to your calendar.
|
|
1932
1983
|
*
|
|
1933
1984
|
* ```javascript
|
|
1934
|
-
* cal
|
|
1935
|
-
* company: 'My Company',
|
|
1936
|
-
* product: 'My Product',
|
|
1937
|
-
* language: 'EN' // optional, defaults to EN
|
|
1938
|
-
* });
|
|
1939
|
-
* ```
|
|
1985
|
+
* const cal = ical();
|
|
1940
1986
|
*
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
1943
|
-
*
|
|
1987
|
+
* cal.events([
|
|
1988
|
+
* {
|
|
1989
|
+
* start: new Date(),
|
|
1990
|
+
* end: new Date(new Date().getTime() + 3600000),
|
|
1991
|
+
* summary: 'Example Event',
|
|
1992
|
+
* description: 'It works ;)',
|
|
1993
|
+
* url: 'http://sebbo.net/'
|
|
1994
|
+
* }
|
|
1995
|
+
* ]);
|
|
1996
|
+
*
|
|
1997
|
+
* cal.events(); // --> [ICalEvent]
|
|
1944
1998
|
* ```
|
|
1945
1999
|
*
|
|
1946
2000
|
* @since 0.2.0
|
|
1947
2001
|
*/
|
|
1948
|
-
|
|
2002
|
+
events(events: (ICalEvent | ICalEventData)[]): this;
|
|
2003
|
+
/**
|
|
2004
|
+
* Get the number of events added to your calendar
|
|
2005
|
+
*/
|
|
2006
|
+
length(): number;
|
|
1949
2007
|
/**
|
|
1950
2008
|
* Get the feed method attribute.
|
|
1951
2009
|
* See {@link ICalCalendarMethod} for possible results.
|
|
@@ -1972,7 +2030,7 @@ declare class ICalCalendar {
|
|
|
1972
2030
|
* Get your feed's name
|
|
1973
2031
|
* @since 0.2.0
|
|
1974
2032
|
*/
|
|
1975
|
-
name():
|
|
2033
|
+
name(): null | string;
|
|
1976
2034
|
/**
|
|
1977
2035
|
* Set your feed's name. Is used to fill `NAME`
|
|
1978
2036
|
* and `X-WR-CALNAME` in your iCal file.
|
|
@@ -1997,22 +2055,80 @@ declare class ICalCalendar {
|
|
|
1997
2055
|
*
|
|
1998
2056
|
* @since 0.2.0
|
|
1999
2057
|
*/
|
|
2000
|
-
name(name:
|
|
2058
|
+
name(name: null | string): this;
|
|
2001
2059
|
/**
|
|
2002
|
-
* Get your feed's
|
|
2003
|
-
* @since 0.2.
|
|
2060
|
+
* Get your feed's prodid. Will always return a string.
|
|
2061
|
+
* @since 0.2.0
|
|
2004
2062
|
*/
|
|
2005
|
-
|
|
2063
|
+
prodId(): string;
|
|
2006
2064
|
/**
|
|
2007
|
-
* Set your feed's
|
|
2008
|
-
*
|
|
2065
|
+
* Set your feed's prodid. `prodid` can be either a
|
|
2066
|
+
* string like `//sebbo.net//ical-generator//EN` or a
|
|
2067
|
+
* valid {@link ICalCalendarProdIdData} object. `language`
|
|
2068
|
+
* is optional and defaults to `EN`.
|
|
2069
|
+
*
|
|
2070
|
+
* ```javascript
|
|
2071
|
+
* cal.prodId({
|
|
2072
|
+
* company: 'My Company',
|
|
2073
|
+
* product: 'My Product',
|
|
2074
|
+
* language: 'EN' // optional, defaults to EN
|
|
2075
|
+
* });
|
|
2076
|
+
* ```
|
|
2077
|
+
*
|
|
2078
|
+
* `cal.toString()` would then produce the following string:
|
|
2079
|
+
* ```text
|
|
2080
|
+
* PRODID:-//My Company//My Product//EN
|
|
2081
|
+
* ```
|
|
2082
|
+
*
|
|
2083
|
+
* @since 0.2.0
|
|
2084
|
+
*/
|
|
2085
|
+
prodId(prodId: ICalCalendarProdIdData | string): this;
|
|
2086
|
+
/**
|
|
2087
|
+
* Get current value of the `CALSCALE` attribute. It will
|
|
2088
|
+
* return `null` if no value was set. The iCal standard
|
|
2089
|
+
* specifies this as `GREGORIAN` if no value is present.
|
|
2090
|
+
*
|
|
2091
|
+
* @since 1.8.0
|
|
2092
|
+
*/
|
|
2093
|
+
scale(): null | string;
|
|
2094
|
+
/**
|
|
2095
|
+
* Use this method to set your feed's `CALSCALE` attribute. There is no
|
|
2096
|
+
* default value for this property and it will not appear in your iCal
|
|
2097
|
+
* file unless set. The iCal standard specifies this as `GREGORIAN` if
|
|
2098
|
+
* no value is present.
|
|
2099
|
+
*
|
|
2100
|
+
* ```javascript
|
|
2101
|
+
* cal.scale('gregorian');
|
|
2102
|
+
* ```
|
|
2103
|
+
*
|
|
2104
|
+
* @since 1.8.0
|
|
2105
|
+
*/
|
|
2106
|
+
scale(scale: null | string): this;
|
|
2107
|
+
/**
|
|
2108
|
+
* Get current value of the `SOURCE` attribute.
|
|
2109
|
+
* @since 2.2.0-develop.1
|
|
2110
|
+
*/
|
|
2111
|
+
source(): null | string;
|
|
2112
|
+
/**
|
|
2113
|
+
* Use this method to set your feed's `SOURCE` attribute.
|
|
2114
|
+
* This tells the client where to refresh your feed.
|
|
2115
|
+
*
|
|
2116
|
+
* ```javascript
|
|
2117
|
+
* cal.source('http://example.com/my/original_source.ical');
|
|
2118
|
+
* ```
|
|
2119
|
+
*
|
|
2120
|
+
* ```text
|
|
2121
|
+
* SOURCE;VALUE=URI:http://example.com/my/original_source.ical
|
|
2122
|
+
* ```
|
|
2123
|
+
*
|
|
2124
|
+
* @since 2.2.0-develop.1
|
|
2009
2125
|
*/
|
|
2010
|
-
|
|
2126
|
+
source(source: null | string): this;
|
|
2011
2127
|
/**
|
|
2012
2128
|
* Get the current calendar timezone
|
|
2013
2129
|
* @since 0.2.0
|
|
2014
2130
|
*/
|
|
2015
|
-
timezone():
|
|
2131
|
+
timezone(): null | string;
|
|
2016
2132
|
/**
|
|
2017
2133
|
* Use this method to set your feed's timezone. Is used
|
|
2018
2134
|
* to fill `TIMEZONE-ID` and `X-WR-TIMEZONE` in your iCal export.
|
|
@@ -2027,7 +2143,7 @@ declare class ICalCalendar {
|
|
|
2027
2143
|
* @see https://github.com/sebbo2002/ical-generator#-date-time--timezones
|
|
2028
2144
|
* @since 0.2.0
|
|
2029
2145
|
*/
|
|
2030
|
-
timezone(timezone:
|
|
2146
|
+
timezone(timezone: null | string): this;
|
|
2031
2147
|
/**
|
|
2032
2148
|
* Sets the time zone to be used in this calendar file for all times of all
|
|
2033
2149
|
* events. Please note that if the time zone is set, ical-generator assumes
|
|
@@ -2062,68 +2178,37 @@ declare class ICalCalendar {
|
|
|
2062
2178
|
* @see https://github.com/sebbo2002/ical-generator#-date-time--timezones
|
|
2063
2179
|
* @since 2.0.0
|
|
2064
2180
|
*/
|
|
2065
|
-
timezone(timezone: ICalTimezone |
|
|
2066
|
-
/**
|
|
2067
|
-
* Get current value of the `SOURCE` attribute.
|
|
2068
|
-
* @since 2.2.0-develop.1
|
|
2069
|
-
*/
|
|
2070
|
-
source(): string | null;
|
|
2181
|
+
timezone(timezone: ICalTimezone | null | string): this;
|
|
2071
2182
|
/**
|
|
2072
|
-
*
|
|
2073
|
-
*
|
|
2183
|
+
* Return a shallow copy of the calendar's options for JSON stringification.
|
|
2184
|
+
* Third party objects like moment.js values or RRule objects are stringified
|
|
2185
|
+
* as well. Can be used for persistence.
|
|
2074
2186
|
*
|
|
2075
2187
|
* ```javascript
|
|
2076
|
-
* cal
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
2079
|
-
* ```text
|
|
2080
|
-
* SOURCE;VALUE=URI:http://example.com/my/original_source.ical
|
|
2081
|
-
* ```
|
|
2082
|
-
*
|
|
2083
|
-
* @since 2.2.0-develop.1
|
|
2084
|
-
*/
|
|
2085
|
-
source(source: string | null): this;
|
|
2086
|
-
/**
|
|
2087
|
-
* Get your feed's URL
|
|
2088
|
-
* @since 0.2.5
|
|
2089
|
-
*/
|
|
2090
|
-
url(): string | null;
|
|
2091
|
-
/**
|
|
2092
|
-
* Set your feed's URL
|
|
2188
|
+
* const cal = ical();
|
|
2189
|
+
* const json = JSON.stringify(cal);
|
|
2093
2190
|
*
|
|
2094
|
-
*
|
|
2095
|
-
*
|
|
2191
|
+
* // later: restore calendar data
|
|
2192
|
+
* cal = ical(JSON.parse(json));
|
|
2096
2193
|
* ```
|
|
2097
2194
|
*
|
|
2098
|
-
* @since 0.2.
|
|
2099
|
-
*/
|
|
2100
|
-
url(url: string | null): this;
|
|
2101
|
-
/**
|
|
2102
|
-
* Get current value of the `CALSCALE` attribute. It will
|
|
2103
|
-
* return `null` if no value was set. The iCal standard
|
|
2104
|
-
* specifies this as `GREGORIAN` if no value is present.
|
|
2105
|
-
*
|
|
2106
|
-
* @since 1.8.0
|
|
2195
|
+
* @since 0.2.4
|
|
2107
2196
|
*/
|
|
2108
|
-
|
|
2197
|
+
toJSON(): ICalCalendarJSONData;
|
|
2109
2198
|
/**
|
|
2110
|
-
*
|
|
2111
|
-
* default value for this property and it will not appear in your iCal
|
|
2112
|
-
* file unless set. The iCal standard specifies this as `GREGORIAN` if
|
|
2113
|
-
* no value is present.
|
|
2199
|
+
* Return generated calendar as a string.
|
|
2114
2200
|
*
|
|
2115
2201
|
* ```javascript
|
|
2116
|
-
* cal
|
|
2202
|
+
* const cal = ical();
|
|
2203
|
+
* console.log(cal.toString()); // → BEGIN:VCALENDAR…
|
|
2117
2204
|
* ```
|
|
2118
|
-
*
|
|
2119
|
-
* @since 1.8.0
|
|
2120
2205
|
*/
|
|
2121
|
-
|
|
2206
|
+
toString(): string;
|
|
2122
2207
|
/**
|
|
2123
2208
|
* Get the current ttl duration in seconds
|
|
2124
2209
|
* @since 0.2.5
|
|
2125
2210
|
*/
|
|
2126
|
-
ttl():
|
|
2211
|
+
ttl(): null | number;
|
|
2127
2212
|
/**
|
|
2128
2213
|
* Use this method to set your feed's time to live
|
|
2129
2214
|
* (in seconds). Is used to fill `REFRESH-INTERVAL` and
|
|
@@ -2138,78 +2223,22 @@ declare class ICalCalendar {
|
|
|
2138
2223
|
*
|
|
2139
2224
|
* @since 0.2.5
|
|
2140
2225
|
*/
|
|
2141
|
-
ttl(ttl:
|
|
2142
|
-
/**
|
|
2143
|
-
* Creates a new {@link ICalEvent} and returns it. Use options to prefill the event's attributes.
|
|
2144
|
-
* Calling this method without options will create an empty event.
|
|
2145
|
-
*
|
|
2146
|
-
* ```javascript
|
|
2147
|
-
* import ical from 'ical-generator';
|
|
2148
|
-
*
|
|
2149
|
-
* // or use require:
|
|
2150
|
-
* // const { default: ical } = require('ical-generator');
|
|
2151
|
-
*
|
|
2152
|
-
* const cal = ical();
|
|
2153
|
-
* const event = cal.createEvent({summary: 'My Event'});
|
|
2154
|
-
*
|
|
2155
|
-
* // overwrite event summary
|
|
2156
|
-
* event.summary('Your Event');
|
|
2157
|
-
* ```
|
|
2158
|
-
*
|
|
2159
|
-
* @since 0.2.0
|
|
2160
|
-
*/
|
|
2161
|
-
createEvent(data: ICalEvent | ICalEventData): ICalEvent;
|
|
2226
|
+
ttl(ttl: ICalMomentDurationStub | null | number): this;
|
|
2162
2227
|
/**
|
|
2163
|
-
*
|
|
2164
|
-
*
|
|
2165
|
-
* ```javascript
|
|
2166
|
-
* const cal = ical();
|
|
2167
|
-
*
|
|
2168
|
-
* cal.events([
|
|
2169
|
-
* {
|
|
2170
|
-
* start: new Date(),
|
|
2171
|
-
* end: new Date(new Date().getTime() + 3600000),
|
|
2172
|
-
* summary: 'Example Event',
|
|
2173
|
-
* description: 'It works ;)',
|
|
2174
|
-
* url: 'http://sebbo.net/'
|
|
2175
|
-
* }
|
|
2176
|
-
* ]);
|
|
2177
|
-
*
|
|
2178
|
-
* cal.events(); // --> [ICalEvent]
|
|
2179
|
-
* ```
|
|
2180
|
-
*
|
|
2181
|
-
* @since 0.2.0
|
|
2228
|
+
* Get your feed's URL
|
|
2229
|
+
* @since 0.2.5
|
|
2182
2230
|
*/
|
|
2183
|
-
|
|
2231
|
+
url(): null | string;
|
|
2184
2232
|
/**
|
|
2185
|
-
*
|
|
2233
|
+
* Set your feed's URL
|
|
2186
2234
|
*
|
|
2187
2235
|
* ```javascript
|
|
2188
|
-
*
|
|
2189
|
-
*
|
|
2190
|
-
* cal.events([
|
|
2191
|
-
* {
|
|
2192
|
-
* start: new Date(),
|
|
2193
|
-
* end: new Date(new Date().getTime() + 3600000),
|
|
2194
|
-
* summary: 'Example Event',
|
|
2195
|
-
* description: 'It works ;)',
|
|
2196
|
-
* url: 'http://sebbo.net/'
|
|
2197
|
-
* }
|
|
2198
|
-
* ]);
|
|
2199
|
-
*
|
|
2200
|
-
* cal.events(); // --> [ICalEvent]
|
|
2236
|
+
* calendar.url('http://example.com/my/feed.ical');
|
|
2201
2237
|
* ```
|
|
2202
2238
|
*
|
|
2203
|
-
* @since 0.2.
|
|
2204
|
-
*/
|
|
2205
|
-
events(events: (ICalEvent | ICalEventData)[]): this;
|
|
2206
|
-
/**
|
|
2207
|
-
* Remove all events from the calendar without
|
|
2208
|
-
* touching any other data like name or prodId.
|
|
2209
|
-
*
|
|
2210
|
-
* @since 2.0.0-develop.1
|
|
2239
|
+
* @since 0.2.5
|
|
2211
2240
|
*/
|
|
2212
|
-
|
|
2241
|
+
url(url: null | string): this;
|
|
2213
2242
|
/**
|
|
2214
2243
|
* Set X-* attributes. Woun't filter double attributes,
|
|
2215
2244
|
* which are also added by another method (e.g. busystatus),
|
|
@@ -2242,10 +2271,10 @@ declare class ICalCalendar {
|
|
|
2242
2271
|
*
|
|
2243
2272
|
* @since 1.9.0
|
|
2244
2273
|
*/
|
|
2245
|
-
x(keyOrArray: {
|
|
2274
|
+
x(keyOrArray: [string, string][] | Record<string, string> | {
|
|
2246
2275
|
key: string;
|
|
2247
2276
|
value: string;
|
|
2248
|
-
}[]
|
|
2277
|
+
}[]): this;
|
|
2249
2278
|
/**
|
|
2250
2279
|
* Set a X-* attribute. Woun't filter double attributes,
|
|
2251
2280
|
* which are also added by another method (e.g. busystatus),
|
|
@@ -2274,58 +2303,29 @@ declare class ICalCalendar {
|
|
|
2274
2303
|
key: string;
|
|
2275
2304
|
value: string;
|
|
2276
2305
|
}[];
|
|
2277
|
-
/**
|
|
2278
|
-
* Return a shallow copy of the calendar's options for JSON stringification.
|
|
2279
|
-
* Third party objects like moment.js values or RRule objects are stringified
|
|
2280
|
-
* as well. Can be used for persistence.
|
|
2281
|
-
*
|
|
2282
|
-
* ```javascript
|
|
2283
|
-
* const cal = ical();
|
|
2284
|
-
* const json = JSON.stringify(cal);
|
|
2285
|
-
*
|
|
2286
|
-
* // later: restore calendar data
|
|
2287
|
-
* cal = ical(JSON.parse(json));
|
|
2288
|
-
* ```
|
|
2289
|
-
*
|
|
2290
|
-
* @since 0.2.4
|
|
2291
|
-
*/
|
|
2292
|
-
toJSON(): ICalCalendarJSONData;
|
|
2293
|
-
/**
|
|
2294
|
-
* Get the number of events added to your calendar
|
|
2295
|
-
*/
|
|
2296
|
-
length(): number;
|
|
2297
|
-
/**
|
|
2298
|
-
* Return generated calendar as a string.
|
|
2299
|
-
*
|
|
2300
|
-
* ```javascript
|
|
2301
|
-
* const cal = ical();
|
|
2302
|
-
* console.log(cal.toString()); // → BEGIN:VCALENDAR…
|
|
2303
|
-
* ```
|
|
2304
|
-
*/
|
|
2305
|
-
toString(): string;
|
|
2306
2306
|
}
|
|
2307
2307
|
|
|
2308
|
+
/**
|
|
2309
|
+
* Escapes special characters in the given string
|
|
2310
|
+
*/
|
|
2311
|
+
declare function escape(str: string | unknown, inQuotes: boolean): string;
|
|
2312
|
+
/**
|
|
2313
|
+
* Trim line length of given string
|
|
2314
|
+
*/
|
|
2315
|
+
declare function foldLines(input: string): string;
|
|
2308
2316
|
/**
|
|
2309
2317
|
* Converts a valid date/time object supported by this library to a string.
|
|
2310
2318
|
*/
|
|
2311
|
-
declare function formatDate(timezone:
|
|
2319
|
+
declare function formatDate(timezone: null | string, d: ICalDateTimeValue, dateonly?: boolean, floating?: boolean): string;
|
|
2312
2320
|
/**
|
|
2313
2321
|
* Converts a valid date/time object supported by this library to a string.
|
|
2314
2322
|
* For information about this format, see RFC 5545, section 3.3.5
|
|
2315
2323
|
* https://tools.ietf.org/html/rfc5545#section-3.3.5
|
|
2316
2324
|
*/
|
|
2317
|
-
declare function formatDateTZ(timezone:
|
|
2325
|
+
declare function formatDateTZ(timezone: null | string, property: string, date: Date | ICalDateTimeValue | string, eventData?: {
|
|
2318
2326
|
floating?: boolean | null;
|
|
2319
|
-
timezone?:
|
|
2327
|
+
timezone?: null | string;
|
|
2320
2328
|
}): string;
|
|
2321
|
-
/**
|
|
2322
|
-
* Escapes special characters in the given string
|
|
2323
|
-
*/
|
|
2324
|
-
declare function escape(str: string | unknown, inQuotes: boolean): string;
|
|
2325
|
-
/**
|
|
2326
|
-
* Trim line length of given string
|
|
2327
|
-
*/
|
|
2328
|
-
declare function foldLines(input: string): string;
|
|
2329
2329
|
|
|
2330
2330
|
/**
|
|
2331
2331
|
* ical-generator entrypoint
|