ical-generator 10.0.0-develop.1 → 10.0.0-develop.2
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 +22 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,8 +81,10 @@ objects and [TZDate](https://github.com/date-fns/tz). You can also pass a string
|
|
|
81
81
|
It is recommended to use UTC time as far as possible. `ical-generator` will output all time information as UTC time as
|
|
82
82
|
long as no time zone is defined. For day.js, a plugin is necessary for this, which is a prerequisite. If a time zone is
|
|
83
83
|
set, `ical-generator` assumes that the given time matches the time zone. If a time zone is used, it is also recommended
|
|
84
|
-
to use a VTimezone generator. Such a function generates a VTimezone entry and returns it. For example,
|
|
85
|
-
be used for this:
|
|
84
|
+
to use a VTimezone generator. Such a function generates a VTimezone entry and returns it. For example,
|
|
85
|
+
`timezones-ical-library` or `@touch4it/ical-timezones` can be used for this:
|
|
86
|
+
|
|
87
|
+
#### Example with `@touch4it/ical-timezones`
|
|
86
88
|
|
|
87
89
|
```typescript
|
|
88
90
|
import { ICalCalendar } from 'ical-generator';
|
|
@@ -90,7 +92,7 @@ import { getVtimezoneComponent } from '@touch4it/ical-timezones';
|
|
|
90
92
|
|
|
91
93
|
const cal = new ICalCalendar();
|
|
92
94
|
cal.timezone({
|
|
93
|
-
name: '
|
|
95
|
+
name: 'Europe/London',
|
|
94
96
|
generator: getVtimezoneComponent,
|
|
95
97
|
});
|
|
96
98
|
cal.createEvent({
|
|
@@ -99,6 +101,23 @@ cal.createEvent({
|
|
|
99
101
|
});
|
|
100
102
|
```
|
|
101
103
|
|
|
104
|
+
#### Example with `timezones-ical-library`
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { ICalCalendar } from 'ical-generator';
|
|
108
|
+
import { tzlib_get_ical_block } from 'timezones-ical-library';
|
|
109
|
+
|
|
110
|
+
const cal = new ICalCalendar();
|
|
111
|
+
cal.timezone({
|
|
112
|
+
name: 'Europe/Berlin',
|
|
113
|
+
generator: (tz) => tzlib_get_ical_block(tz)[0],
|
|
114
|
+
});
|
|
115
|
+
cal.createEvent({
|
|
116
|
+
start: new Date(),
|
|
117
|
+
timezone: 'Europe/London',
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
102
121
|
If a `moment-timezone` object or Luxon's `setZone` method works, `ical-generator` sets it according to the time zone set
|
|
103
122
|
in the calendar/event.
|
|
104
123
|
|
package/package.json
CHANGED