Skip to content

Commit

Permalink
Merge pull request #243 from sebbo2002/feature/vtimezone
Browse files Browse the repository at this point in the history
Add support for external VTimezone generator
  • Loading branch information
sebbo2002 authored Apr 14, 2021
2 parents 6bda01a + 07c9563 commit 7ccb6ca
Show file tree
Hide file tree
Showing 11 changed files with 362 additions and 34 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
steps:
- name: ☁️ Checkout Project
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: ☁️ Checkout ReleaseBot
uses: actions/checkout@v2
with:
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,29 @@ objects. You can also pass a string which is then passed to javascript's `Date`

It is recommended to use UTC time as far as possible. `ical-generator` will output all time information as UTC time as
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
set, `ical-generator` assumes that the given time matches the time zone. If a `moment-timezone` object or Luxon's
`setZone` method works, `ical-generator` sets it according to the time zone set in the calendar/event.
set, `ical-generator` assumes that the given time matches the time zone. If a time zone is used, it is also recommended
to use a VTimezone generator. Such a function generates a VTimezone entry and returns it. For example, ical-timezones can
be used for this:

```typescript
import ical from 'ical-generator';
import {getVtimezoneComponent} from '@touch4it/ical-timezones';

const cal = new ICalCalendar();
cal.timezone({
name: 'FOO',
generator: getVtimezoneComponent
});
cal.createEvent({
start: new Date(),
timezone: 'Europe/London'
});
```

If a `moment-timezone` object or Luxon's `setZone` method works, `ical-generator` sets it according to the time zone set
in the calendar/event.




## 🚦 Tests
Expand Down
193 changes: 191 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@semantic-release/github": "^7.2.0",
"@semantic-release/npm": "^7.1.0",
"@semantic-release/release-notes-generator": "^9.0.2",
"@touch4it/ical-timezones": "^1.6.0",
"@types/luxon": "^1.26.3",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.35",
Expand All @@ -60,6 +61,7 @@
"typescript": "^4.2.3"
},
"peerDependencies": {
"@touch4it/ical-timezones": "^1.6.0",
"@types/luxon": "^1.26.0",
"@types/mocha": "^8.2.1",
"@types/node": "^14.14.31",
Expand Down
Loading

0 comments on commit 7ccb6ca

Please sign in to comment.