{"id":32018157,"url":"https://github.com/httnn/google-calendar-store","last_synced_at":"2026-04-15T12:38:01.211Z","repository":{"id":143756599,"uuid":"94800742","full_name":"httnn/google-calendar-store","owner":"httnn","description":"A library that fetches and stores events from Google calendars, and provides interfaces for querying events.","archived":false,"fork":false,"pushed_at":"2018-01-04T18:35:28.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-26T11:48:40.348Z","etag":null,"topics":["google-calendar","nodejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/httnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-06-19T17:03:36.000Z","updated_at":"2019-11-23T16:53:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"5a0240d2-5de2-4fbd-9e83-bf08fac1f240","html_url":"https://github.com/httnn/google-calendar-store","commit_stats":null,"previous_names":["httnn/google-calendar-store"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/httnn/google-calendar-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httnn%2Fgoogle-calendar-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httnn%2Fgoogle-calendar-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httnn%2Fgoogle-calendar-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httnn%2Fgoogle-calendar-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/httnn","download_url":"https://codeload.github.com/httnn/google-calendar-store/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httnn%2Fgoogle-calendar-store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31842190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T11:29:19.690Z","status":"ssl_error","status_checked_at":"2026-04-15T11:29:19.171Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-calendar","nodejs"],"created_at":"2025-10-16T01:19:35.006Z","updated_at":"2026-04-15T12:38:01.194Z","avatar_url":"https://github.com/httnn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-calendar-store\nA library that fetches and stores events from Google calendars, and provides interfaces for querying events. Useful for displaying Google calendar events in custom ways.\n\n## Install\n`npm install google-calendar-store`\n\n## Quick start\n```js\n// 1. Import relevant classes and moment.\nimport {Calendar, MemoryStorage} from 'google-calendar-store';\nimport moment from 'moment';\n\n(async () =\u003e {\n  // 2. Create storage engine.\n  const storage = new MongoStorage();\n  await storage.init();\n\n  // 3. Create calendar.\n  const calendar = new Calendar({\n    googleId: 'GOOGLE CALENDAR ID HERE',\n    apiKey: 'GOOGLE API KEY HERE',\n    storage\n  });\n\n  // 4. Start fetching events every 5 minutes.\n  calendar.startEventUpdates();\n\n  // 5. Query events.\n  const start = moment();\n  const end = start.clone().add({months: 3});\n  const weeks = await calendar.getFilledCalendar(start, end);\n\n  // 6. Do something with events.\n  for (const week of weeks) {\n    for (const day of week.days) {\n      for (const event of day.events) {\n        console.log(event.description);\n      }\n    }\n  }\n})();\n```\n\n## API\n\n### class Calendar\n```ts\n// Instantiates a new Calendar instance for a specific Google calendar.\nconst calendar = new Calendar({googleId: string, storage: EventStorage, apiKey: string})\n\n// Fetches and updates events from Google, going back how every many years specified as the argument.\ncalendar.updateEvents(years?: number = 1)\n\n// Fetches events every intervalMinutes minutes, the years argument is the same one as with updateEvents.\ncalendar.startEventUpdates(intervalMinutes: number = 5, years?: number): void\n\n// Stops automatic updates initiated by startEventUpdates.\ncalendar.stopEventUpdates(): void\n\n// Fetches events from the storage as specified by start and end times.\ncalendar.getEvents(start: Moment, end?: Moment): Promise\u003cArray\u003cCalendarEvent\u003e\u003e\n\n// Returns a structure with an instance for every day within the range even if the day doesn't contain any events.\ncalendar.getFilledCalendar(start: number | Moment, end: number | Moment, weekdays: Array\u003cnumber\u003e): Promise\u003cArray\u003cWeek\u003e\u003e\n```\n\n### class CalendarEvent\n```ts\n// Not meant to be instantiated anywhere else than in an EventStorage.\n\n// Properties:\ngoogleId: string;\ncalendarGoogleId: string;\nsummary: string;\ndescription: string;\nstart: Date;\nend: Date;\ncancelled: boolean;\n\n// Methods:\nisPast(): boolean;\nisToday(): boolean;\n```\n\n### class Day\n```ts\n// Not meant to be instantiated.\n\n// Properties:\ndate: Moment;\nevents: Array\u003cCalendarEvent\u003e = [];\n\n// Methods:\nhasEvents(): boolean;\n```\n\n### class Week\n```ts\n// Not meant to be instantiated.\n\n// Properties:\ndays: Array\u003cDay\u003e;\n\n// Methods:\nhasEvents(): boolean;\n```\n\n### class MongoStorage\n```ts\nconst storage = new MongoStorage();\n\nstorage.init(url: string = process.env.MONGO_URL): Promise\u003cvoid\u003e;\n```\n\n### class MemoryStorage\n```ts\n// Used for debugging, use a proper storage driver for production use.\n\nconst storage = new MemoryStorage();\n```\n\n\n\n\n## Storage engines\nThis library comes equipped with two storage engines:\n1. `MemoryStorage`, which stores events in memory.\n2. `MongoStorage`, which stores events in MongoDB.\n\nCreating a new MemoryStorage is easy, it just needs to implement the `EventStorage` interface.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhttnn%2Fgoogle-calendar-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhttnn%2Fgoogle-calendar-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhttnn%2Fgoogle-calendar-store/lists"}