ical-generator 6.0.2-develop.1 → 6.0.2-develop.10
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 +5 -10
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +268 -47
- package/dist/index.d.ts +268 -47
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/alarm.ts +12 -12
- package/src/attendee.ts +11 -11
- package/src/calendar.ts +63 -8
- package/src/category.ts +6 -5
- package/src/event.ts +211 -17
- package/src/index.ts +8 -2
package/src/event.ts
CHANGED
|
@@ -94,7 +94,7 @@ interface ICalEventInternalData {
|
|
|
94
94
|
stamp: ICalDateTimeValue,
|
|
95
95
|
allDay: boolean,
|
|
96
96
|
floating: boolean,
|
|
97
|
-
repeating:
|
|
97
|
+
repeating: ICalEventJSONRepeatingData | ICalRRuleStub | string | null,
|
|
98
98
|
summary: string,
|
|
99
99
|
location: ICalLocation | null,
|
|
100
100
|
description: ICalDescription | null,
|
|
@@ -124,7 +124,7 @@ export interface ICalEventJSONData {
|
|
|
124
124
|
stamp: string,
|
|
125
125
|
allDay: boolean,
|
|
126
126
|
floating: boolean,
|
|
127
|
-
repeating:
|
|
127
|
+
repeating: ICalEventJSONRepeatingData | string | null,
|
|
128
128
|
summary: string,
|
|
129
129
|
location: ICalLocation | null,
|
|
130
130
|
description: ICalDescription | null,
|
|
@@ -143,7 +143,7 @@ export interface ICalEventJSONData {
|
|
|
143
143
|
x: {key: string, value: string}[];
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
interface
|
|
146
|
+
export interface ICalEventJSONRepeatingData {
|
|
147
147
|
freq: ICalEventRepeatingFreq;
|
|
148
148
|
count?: number;
|
|
149
149
|
interval?: number;
|
|
@@ -158,7 +158,7 @@ interface ICalEventInternalRepeatingData {
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
* Usually you get an
|
|
161
|
+
* Usually you get an {@link ICalEvent} object like this:
|
|
162
162
|
* ```javascript
|
|
163
163
|
* import ical from 'ical-generator';
|
|
164
164
|
* const calendar = ical();
|
|
@@ -326,6 +326,35 @@ export default class ICalEvent {
|
|
|
326
326
|
* [Readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
327
327
|
* for details about supported values and timezone handling.
|
|
328
328
|
*
|
|
329
|
+
* ```typescript
|
|
330
|
+
* import ical from 'ical-generator';
|
|
331
|
+
*
|
|
332
|
+
* const cal = ical();
|
|
333
|
+
*
|
|
334
|
+
* const event = cal.createEvent({
|
|
335
|
+
* start: new Date('2020-01-01')
|
|
336
|
+
* });
|
|
337
|
+
*
|
|
338
|
+
* // overwrites old start date
|
|
339
|
+
* event.start(new Date('2024-02-01'));
|
|
340
|
+
*
|
|
341
|
+
* cal.toString();
|
|
342
|
+
* ```
|
|
343
|
+
*
|
|
344
|
+
* ```text
|
|
345
|
+
* BEGIN:VCALENDAR
|
|
346
|
+
* VERSION:2.0
|
|
347
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
348
|
+
* BEGIN:VEVENT
|
|
349
|
+
* UID:7e2aee64-b07a-4256-9b3e-e9eaa452bac8
|
|
350
|
+
* SEQUENCE:0
|
|
351
|
+
* DTSTAMP:20240212T190915Z
|
|
352
|
+
* DTSTART:20240201T000000Z
|
|
353
|
+
* SUMMARY:
|
|
354
|
+
* END:VEVENT
|
|
355
|
+
* END:VCALENDAR
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
329
358
|
* @since 0.2.0
|
|
330
359
|
*/
|
|
331
360
|
start(start: ICalDateTimeValue): this;
|
|
@@ -513,6 +542,36 @@ export default class ICalEvent {
|
|
|
513
542
|
* event.allDay(true); // → appointment is for the whole day
|
|
514
543
|
* ```
|
|
515
544
|
*
|
|
545
|
+
* ```typescript
|
|
546
|
+
* import ical from 'ical-generator';
|
|
547
|
+
*
|
|
548
|
+
* const cal = ical();
|
|
549
|
+
*
|
|
550
|
+
* cal.createEvent({
|
|
551
|
+
* start: new Date('2020-01-01'),
|
|
552
|
+
* summary: 'Very Important Day',
|
|
553
|
+
* allDay: true
|
|
554
|
+
* });
|
|
555
|
+
*
|
|
556
|
+
* cal.toString();
|
|
557
|
+
* ```
|
|
558
|
+
*
|
|
559
|
+
* ```text
|
|
560
|
+
* BEGIN:VCALENDAR
|
|
561
|
+
* VERSION:2.0
|
|
562
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
563
|
+
* BEGIN:VEVENT
|
|
564
|
+
* UID:1964fe8d-32c5-4f2a-bd62-7d9d7de5992b
|
|
565
|
+
* SEQUENCE:0
|
|
566
|
+
* DTSTAMP:20240212T191956Z
|
|
567
|
+
* DTSTART;VALUE=DATE:20200101
|
|
568
|
+
* X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
|
|
569
|
+
* X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE
|
|
570
|
+
* SUMMARY:Very Important Day
|
|
571
|
+
* END:VEVENT
|
|
572
|
+
* END:VCALENDAR
|
|
573
|
+
* ```
|
|
574
|
+
*
|
|
516
575
|
* @since 0.2.0
|
|
517
576
|
*/
|
|
518
577
|
allDay(allDay: boolean): this;
|
|
@@ -537,6 +596,34 @@ export default class ICalEvent {
|
|
|
537
596
|
* Events whose floating flag is set to true always take place at the
|
|
538
597
|
* same time, regardless of the time zone.
|
|
539
598
|
*
|
|
599
|
+
* ```typescript
|
|
600
|
+
* import ical from 'ical-generator';
|
|
601
|
+
*
|
|
602
|
+
* const cal = ical();
|
|
603
|
+
*
|
|
604
|
+
* cal.createEvent({
|
|
605
|
+
* start: new Date('2020-01-01T20:00:00Z'),
|
|
606
|
+
* summary: 'Always at 20:00 in every <Timezone',
|
|
607
|
+
* floating: true
|
|
608
|
+
* });
|
|
609
|
+
*
|
|
610
|
+
* cal.toString();
|
|
611
|
+
* ```
|
|
612
|
+
*
|
|
613
|
+
* ```text
|
|
614
|
+
* BEGIN:VCALENDAR
|
|
615
|
+
* VERSION:2.0
|
|
616
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
617
|
+
* BEGIN:VEVENT
|
|
618
|
+
* UID:5d7278f9-ada3-40ef-83d1-23c29ce0a763
|
|
619
|
+
* SEQUENCE:0
|
|
620
|
+
* DTSTAMP:20240212T192214Z
|
|
621
|
+
* DTSTART:20200101T200000
|
|
622
|
+
* SUMMARY:Always at 20:00 in every <Timezone
|
|
623
|
+
* END:VEVENT
|
|
624
|
+
* END:VCALENDAR
|
|
625
|
+
* ```
|
|
626
|
+
*
|
|
540
627
|
* @since 0.2.0
|
|
541
628
|
*/
|
|
542
629
|
floating(floating?: boolean): this | boolean {
|
|
@@ -556,10 +643,10 @@ export default class ICalEvent {
|
|
|
556
643
|
* Get the event's repeating options
|
|
557
644
|
* @since 0.2.0
|
|
558
645
|
*/
|
|
559
|
-
repeating():
|
|
646
|
+
repeating(): ICalEventJSONRepeatingData | ICalRRuleStub | string | null;
|
|
560
647
|
|
|
561
648
|
/**
|
|
562
|
-
* Set the event's repeating options by passing an
|
|
649
|
+
* Set the event's repeating options by passing an {@link ICalRepeatingOptions} object.
|
|
563
650
|
*
|
|
564
651
|
* ```javascript
|
|
565
652
|
* event.repeating({
|
|
@@ -577,6 +664,40 @@ export default class ICalEvent {
|
|
|
577
664
|
* });
|
|
578
665
|
* ```
|
|
579
666
|
*
|
|
667
|
+
* **Example:**
|
|
668
|
+
*
|
|
669
|
+
*```typescript
|
|
670
|
+
* import ical, { ICalEventRepeatingFreq } from 'ical-generator';
|
|
671
|
+
*
|
|
672
|
+
* const cal = ical();
|
|
673
|
+
*
|
|
674
|
+
* const event = cal.createEvent({
|
|
675
|
+
* start: new Date('2020-01-01T20:00:00Z'),
|
|
676
|
+
* summary: 'Repeating Event'
|
|
677
|
+
* });
|
|
678
|
+
* event.repeating({
|
|
679
|
+
* freq: ICalEventRepeatingFreq.WEEKLY,
|
|
680
|
+
* count: 4
|
|
681
|
+
* });
|
|
682
|
+
*
|
|
683
|
+
* cal.toString();
|
|
684
|
+
* ```
|
|
685
|
+
*
|
|
686
|
+
* ```text
|
|
687
|
+
* BEGIN:VCALENDAR
|
|
688
|
+
* VERSION:2.0
|
|
689
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
690
|
+
* BEGIN:VEVENT
|
|
691
|
+
* UID:b80e6a68-c2cd-48f5-b94d-cecc7ce83871
|
|
692
|
+
* SEQUENCE:0
|
|
693
|
+
* DTSTAMP:20240212T193646Z
|
|
694
|
+
* DTSTART:20200101T200000Z
|
|
695
|
+
* RRULE:FREQ=WEEKLY;COUNT=4
|
|
696
|
+
* SUMMARY:Repeating Event
|
|
697
|
+
* END:VEVENT
|
|
698
|
+
* END:VCALENDAR
|
|
699
|
+
* ```
|
|
700
|
+
*
|
|
580
701
|
* @since 0.2.0
|
|
581
702
|
*/
|
|
582
703
|
repeating(repeating: ICalRepeatingOptions | null): this;
|
|
@@ -584,6 +705,44 @@ export default class ICalEvent {
|
|
|
584
705
|
/**
|
|
585
706
|
* Set the event's repeating options by passing an [RRule object](https://github.com/jakubroztocil/rrule).
|
|
586
707
|
* @since 2.0.0-develop.5
|
|
708
|
+
*
|
|
709
|
+
* ```typescript
|
|
710
|
+
* import ical from 'ical-generator';
|
|
711
|
+
* import { datetime, RRule } from 'rrule';
|
|
712
|
+
*
|
|
713
|
+
* const cal = ical();
|
|
714
|
+
*
|
|
715
|
+
* const event = cal.createEvent({
|
|
716
|
+
* start: new Date('2020-01-01T20:00:00Z'),
|
|
717
|
+
* summary: 'Repeating Event'
|
|
718
|
+
* });
|
|
719
|
+
*
|
|
720
|
+
* const rule = new RRule({
|
|
721
|
+
* freq: RRule.WEEKLY,
|
|
722
|
+
* interval: 5,
|
|
723
|
+
* byweekday: [RRule.MO, RRule.FR],
|
|
724
|
+
* dtstart: datetime(2012, 2, 1, 10, 30),
|
|
725
|
+
* until: datetime(2012, 12, 31)
|
|
726
|
+
* })
|
|
727
|
+
* event.repeating(rule);
|
|
728
|
+
*
|
|
729
|
+
* cal.toString();
|
|
730
|
+
* ```
|
|
731
|
+
*
|
|
732
|
+
* ```text
|
|
733
|
+
* BEGIN:VCALENDAR
|
|
734
|
+
* VERSION:2.0
|
|
735
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
736
|
+
* BEGIN:VEVENT
|
|
737
|
+
* UID:36585e40-8fa8-460d-af0c-88b6f434030b
|
|
738
|
+
* SEQUENCE:0
|
|
739
|
+
* DTSTAMP:20240212T193827Z
|
|
740
|
+
* DTSTART:20200101T200000Z
|
|
741
|
+
* RRULE:FREQ=WEEKLY;INTERVAL=5;BYDAY=MO,FR;UNTIL=20121231T000000Z
|
|
742
|
+
* SUMMARY:Repeating Event
|
|
743
|
+
* END:VEVENT
|
|
744
|
+
* END:VCALENDAR
|
|
745
|
+
* ```
|
|
587
746
|
*/
|
|
588
747
|
repeating(repeating: ICalRRuleStub | null): this;
|
|
589
748
|
|
|
@@ -597,7 +756,7 @@ export default class ICalEvent {
|
|
|
597
756
|
* @internal
|
|
598
757
|
*/
|
|
599
758
|
repeating(repeating: ICalRepeatingOptions | ICalRRuleStub | string | null): this;
|
|
600
|
-
repeating(repeating?: ICalRepeatingOptions | ICalRRuleStub | string | null): this |
|
|
759
|
+
repeating(repeating?: ICalRepeatingOptions | ICalRRuleStub | string | null): this | ICalEventJSONRepeatingData | ICalRRuleStub | string | null {
|
|
601
760
|
if (repeating === undefined) {
|
|
602
761
|
return this.data.repeating;
|
|
603
762
|
}
|
|
@@ -721,7 +880,7 @@ export default class ICalEvent {
|
|
|
721
880
|
|
|
722
881
|
/**
|
|
723
882
|
* Set the event's location by passing a string (minimum) or
|
|
724
|
-
* an
|
|
883
|
+
* an {@link ICalLocation} object which will also fill the iCal
|
|
725
884
|
* `GEO` attribute and Apple's `X-APPLE-STRUCTURED-LOCATION`.
|
|
726
885
|
*
|
|
727
886
|
* ```javascript
|
|
@@ -736,6 +895,15 @@ export default class ICalEvent {
|
|
|
736
895
|
* });
|
|
737
896
|
* ```
|
|
738
897
|
*
|
|
898
|
+
* ```text
|
|
899
|
+
* LOCATION:Apple Store Kurfürstendamm\nKurfürstendamm 26\, 10719 Berlin\,
|
|
900
|
+
* Deutschland
|
|
901
|
+
* X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=Kurfürstendamm 26\, 10719
|
|
902
|
+
* Berlin\, Deutschland;X-APPLE-RADIUS=141.1751386318387;X-TITLE=Apple Store
|
|
903
|
+
* Kurfürstendamm:geo:52.50363,13.32865
|
|
904
|
+
* GEO:52.50363;13.32865
|
|
905
|
+
* ```
|
|
906
|
+
*
|
|
739
907
|
* @since 0.2.0
|
|
740
908
|
*/
|
|
741
909
|
location(location: ICalLocation | string | null): this;
|
|
@@ -765,7 +933,7 @@ export default class ICalEvent {
|
|
|
765
933
|
|
|
766
934
|
|
|
767
935
|
/**
|
|
768
|
-
* Get the event's description as an
|
|
936
|
+
* Get the event's description as an {@link ICalDescription} object.
|
|
769
937
|
* @since 0.2.0
|
|
770
938
|
*/
|
|
771
939
|
description(): ICalDescription | null;
|
|
@@ -778,11 +946,16 @@ export default class ICalEvent {
|
|
|
778
946
|
*
|
|
779
947
|
* ```javascript
|
|
780
948
|
* event.description({
|
|
781
|
-
* plain: 'Hello World!'
|
|
782
|
-
* html: '<p>Hello World!</p>'
|
|
949
|
+
* plain: 'Hello World!',
|
|
950
|
+
* html: '<p>Hello World!</p>'
|
|
783
951
|
* });
|
|
784
952
|
* ```
|
|
785
953
|
*
|
|
954
|
+
* ```text
|
|
955
|
+
* DESCRIPTION:Hello World!
|
|
956
|
+
* X-ALT-DESC;FMTTYPE=text/html:<p>Hello World!</p>
|
|
957
|
+
* ```
|
|
958
|
+
*
|
|
786
959
|
* @since 0.2.0
|
|
787
960
|
*/
|
|
788
961
|
description(description: ICalDescription | string | null): this;
|
|
@@ -854,19 +1027,40 @@ export default class ICalEvent {
|
|
|
854
1027
|
|
|
855
1028
|
|
|
856
1029
|
/**
|
|
857
|
-
* Creates a new
|
|
1030
|
+
* Creates a new {@link ICalAttendee} and returns it. Use options to prefill
|
|
858
1031
|
* the attendee's attributes. Calling this method without options will create
|
|
859
1032
|
* an empty attendee.
|
|
860
1033
|
*
|
|
861
1034
|
* ```javascript
|
|
1035
|
+
* import ical from 'ical-generator';
|
|
1036
|
+
*
|
|
862
1037
|
* const cal = ical();
|
|
863
|
-
* const event = cal.createEvent(
|
|
864
|
-
*
|
|
1038
|
+
* const event = cal.createEvent({
|
|
1039
|
+
* start: new Date()
|
|
1040
|
+
* });
|
|
1041
|
+
*
|
|
1042
|
+
* event.createAttendee({email: 'hui@example.com', name: 'Hui'});
|
|
865
1043
|
*
|
|
866
1044
|
* // add another attendee
|
|
867
1045
|
* event.createAttendee('Buh <buh@example.net>');
|
|
868
1046
|
* ```
|
|
869
1047
|
*
|
|
1048
|
+
* ```text
|
|
1049
|
+
* BEGIN:VCALENDAR
|
|
1050
|
+
* VERSION:2.0
|
|
1051
|
+
* PRODID:-//sebbo.net//ical-generator//EN
|
|
1052
|
+
* BEGIN:VEVENT
|
|
1053
|
+
* UID:b4944f07-98e4-4581-ac80-2589bb20273d
|
|
1054
|
+
* SEQUENCE:0
|
|
1055
|
+
* DTSTAMP:20240212T194232Z
|
|
1056
|
+
* DTSTART:20240212T194232Z
|
|
1057
|
+
* SUMMARY:
|
|
1058
|
+
* ATTENDEE;ROLE=REQ-PARTICIPANT;CN="Hui":MAILTO:hui@example.com
|
|
1059
|
+
* ATTENDEE;ROLE=REQ-PARTICIPANT;CN="Buh":MAILTO:buh@example.net
|
|
1060
|
+
* END:VEVENT
|
|
1061
|
+
* END:VCALENDAR
|
|
1062
|
+
* ```
|
|
1063
|
+
*
|
|
870
1064
|
* As with the organizer, you can also add an explicit `mailto` address.
|
|
871
1065
|
*
|
|
872
1066
|
* ```javascript
|
|
@@ -927,7 +1121,7 @@ export default class ICalEvent {
|
|
|
927
1121
|
|
|
928
1122
|
|
|
929
1123
|
/**
|
|
930
|
-
* Creates a new
|
|
1124
|
+
* Creates a new {@link ICalAlarm} and returns it. Use options to prefill
|
|
931
1125
|
* the alarm's attributes. Calling this method without options will create
|
|
932
1126
|
* an empty alarm.
|
|
933
1127
|
*
|
|
@@ -986,7 +1180,7 @@ export default class ICalEvent {
|
|
|
986
1180
|
|
|
987
1181
|
|
|
988
1182
|
/**
|
|
989
|
-
* Creates a new
|
|
1183
|
+
* Creates a new {@link ICalCategory} and returns it. Use options to prefill the category's attributes.
|
|
990
1184
|
* Calling this method without options will create an empty category.
|
|
991
1185
|
*
|
|
992
1186
|
* ```javascript
|
|
@@ -1407,7 +1601,7 @@ export default class ICalEvent {
|
|
|
1407
1601
|
* @since 0.2.4
|
|
1408
1602
|
*/
|
|
1409
1603
|
toJSON(): ICalEventJSONData {
|
|
1410
|
-
let repeating:
|
|
1604
|
+
let repeating: ICalEventJSONRepeatingData | string | null = null;
|
|
1411
1605
|
if(isRRule(this.data.repeating) || typeof this.data.repeating === 'string') {
|
|
1412
1606
|
repeating = this.data.repeating.toString();
|
|
1413
1607
|
}
|
package/src/index.ts
CHANGED
|
@@ -49,11 +49,16 @@ export default ical;
|
|
|
49
49
|
export {
|
|
50
50
|
default as ICalAlarm,
|
|
51
51
|
ICalAlarmData,
|
|
52
|
+
ICalAlarmBaseData,
|
|
53
|
+
ICalAlarmJSONData,
|
|
54
|
+
ICalAlarmRelatesTo,
|
|
52
55
|
ICalAlarmRepeatData,
|
|
56
|
+
ICalAlarmTriggerData,
|
|
57
|
+
ICalAlarmTriggerAfterData,
|
|
58
|
+
ICalAlarmTriggerBeforeData,
|
|
53
59
|
ICalAlarmType,
|
|
54
60
|
ICalAlarmTypeValue,
|
|
55
|
-
|
|
56
|
-
ICalAttachment
|
|
61
|
+
ICalAttachment,
|
|
57
62
|
} from './alarm.js';
|
|
58
63
|
|
|
59
64
|
export {
|
|
@@ -86,6 +91,7 @@ export {
|
|
|
86
91
|
ICalEventTransparency,
|
|
87
92
|
ICalEventData,
|
|
88
93
|
ICalEventJSONData,
|
|
94
|
+
ICalEventJSONRepeatingData,
|
|
89
95
|
ICalEventClass,
|
|
90
96
|
} from './event.js';
|
|
91
97
|
|