https://github.com/nstringham/google-calendar-event-fetcher
Fetch and transform events from the Google Calendar API
https://github.com/nstringham/google-calendar-event-fetcher
Last synced: 5 months ago
JSON representation
Fetch and transform events from the Google Calendar API
- Host: GitHub
- URL: https://github.com/nstringham/google-calendar-event-fetcher
- Owner: nstringham
- License: mit
- Created: 2026-01-01T17:03:13.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-11T23:41:52.000Z (5 months ago)
- Last Synced: 2026-01-12T03:23:34.487Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Google Calendar Event Fetcher
Fetch and transform events from the Google Calendar API
## Features
- Get events from Google Calendar
- Transform Events into a form that works for you application
- Only fetch each event once
- Subscribe to the full list of all events for reactivity
- TypeScript Types
## Installation
```bash
npm install google-calendar-event-fetcher
```
## Example Usage
```js
import { GoogleCalendarEventFetcher, isAllDayEvent, convertToDate } from "google-calendar-event-fetcher";
const googleCalendarEventFetcher = new GoogleCalendarEventFetcher({
calendarId: "your_google_calendar_id@group.calendar.google.com",
apiKey: "YOUR_GOOGLE_API_KEY",
transform: (event) => {
return {
title: event.summary,
allDay: isAllDayEvent(event),
start: convertToDate(event.start),
end: convertToDate(event.end),
description: event.description,
};
},
});
googleCalendarEventFetcher.subscribe((events) => {
console.log("All events:", events);
});
googleCalendarEventFetcher.fetchEvents(new Date("2026-01-01"), new Date("2026-02-01"));
```
## Example Usage with FullCalendar
```js
import { Calendar } from "@fullcalendar/core";
import dayGridPlugin from "@fullcalendar/daygrid";
import googleCalendarPlugin from "google-calendar-event-fetcher/fullcalendar";
const calendarElement = document.getElementById("calendar");
const calendar = new Calendar(calendarElement, {
plugins: [dayGridPlugin, googleCalendarPlugin],
initialView: "dayGridMonth",
events: {
googleCalendarId: "your_google_calendar_id@group.calendar.google.com",
googleCalendarApiKey: "YOUR_GOOGLE_API_KEY",
},
});
calendar.render();
```