https://github.com/olillin/iamcal
Read and write .ical calendars
https://github.com/olillin/iamcal
Last synced: over 1 year ago
JSON representation
Read and write .ical calendars
- Host: GitHub
- URL: https://github.com/olillin/iamcal
- Owner: olillin
- License: mit
- Created: 2024-12-08T17:26:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-17T20:27:12.000Z (over 1 year ago)
- Last Synced: 2025-03-27T17:08:50.524Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/iamcal
- Size: 87.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iamcal [](https://github.com/olillin/iamcal/actions/workflows/npm-test.yml) [![npm badge]()](https://www.npmjs.com/package/iamcal)
A library for reading, modifying and writing [ICalendar](https://en.wikipedia.org/wiki/ICalendar) files.
## Installation
**iamcal** can be installed from the npm registry:
```console
npm install iamcal
```
## Getting started/Example
This code;
```typescript
import { Calendar } from 'iamcal'
import { dump } from 'iamcal/io'
import { parseCalendar } from 'iamcal/parse'
const calendar: Calendar = await parseCalendar(`
BEGIN:VCALENDAR
VERSION:2.0
PRODID:example
BEGIN:VEVENT
SUMMARY:🎉iamcal release party
LOCATION:Las Vegas!!
UID:20241209T100000Z-EF79AE@example.com
DTSTAMP:20241209T100000Z
DTSTART:20241211T200000Z
DTEND:20241211T230000Z
END:VEVENT
END:VCALENDAR
`)
calendar.events().forEach(event => {
if (event.summary() === "🎉iamcal release party") {
event.setLocation("My house (budget cuts sorry)")
}
})
await dump(calendar, "./new_calendar.ics")
```
produces the file `new_calendar.ics`:
```icalendar
BEGIN:VCALENDAR
VERSION:2.0
PRODID:example
BEGIN:VEVENT
SUMMARY:🎉iamcal release party
LOCATION:My house (budget cuts sorry)
UID:20241209T100000Z-EF79AE@example.com
DTSTAMP:20241209T100000Z
DTSTART:20241211T200000Z
DTEND:20241211T230000Z
END:VEVENT
END:VCALENDAR
```