{"id":50926111,"url":"https://github.com/ruicsh/use-calendar","last_synced_at":"2026-06-16T23:03:35.334Z","repository":{"id":44419959,"uuid":"512537912","full_name":"ruicsh/use-calendar","owner":"ruicsh","description":"Headless calendar hook for React (no dependencies, WAI-ARIA compliant)","archived":false,"fork":false,"pushed_at":"2025-01-03T20:59:12.000Z","size":1238,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-30T03:08:29.794Z","etag":null,"topics":["calendar","headless","react","reacthooks","wai-aria"],"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/ruicsh.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-10T20:56:14.000Z","updated_at":"2026-04-06T19:48:56.000Z","dependencies_parsed_at":"2024-01-17T13:46:51.132Z","dependency_job_id":"fe7fe1a8-b3a2-4daa-847f-b6d440f8563e","html_url":"https://github.com/ruicsh/use-calendar","commit_stats":null,"previous_names":["ruicsh/use-calendar"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/ruicsh/use-calendar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruicsh%2Fuse-calendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruicsh%2Fuse-calendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruicsh%2Fuse-calendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruicsh%2Fuse-calendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruicsh","download_url":"https://codeload.github.com/ruicsh/use-calendar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruicsh%2Fuse-calendar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34426745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["calendar","headless","react","reacthooks","wai-aria"],"created_at":"2026-06-16T23:03:34.517Z","updated_at":"2026-06-16T23:03:35.325Z","avatar_url":"https://github.com/ruicsh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/logo.png\" alt=\"Logo\" width=\"120\" height=\"120\"\u003e\n  \u003ch1 align=\"center\"\u003euse-calendar\u003c/h3\u003e\n  \u003cp align=\"center\"\u003eHeadless calendar hook for React\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@tuplo/use-calendar\"\u003e\n    \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/@tuplo/use-calendar\"\u003e\n  \t \u003ca href=\"https://codeclimate.com/github/tuplo/use-calendar/test_coverage\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/950de43b7d3e5b4b84c7/test_coverage\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## Why\n\n* No dependencies, tiny footprint\n* Configurable available dates, minimum and maximum dates\n* Weekends, adjacent month's days\n* Previous and next month/year navigation\n* Events\n* WAI-ARIA compliant\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/screenshot.png\" alt=\"Logo\" width=\"240\"\u003e\n\u003c/div\u003e\n\n## Install\n\n```bash\n$ npm install @tuplo/use-calendar\n\n# or with yarn\n$ yarn add @tuplo/use-calendar\n```\n\n## Usage\n\nMinimal example\n\n```jsx\nimport { useCalendar } from '@tuplo/use-calendar'\n\nfunction Calendar() {\n  const {\n    months,\n    getDayProps,\n    getPrevMonthProps,\n    getNextMonthProps\n  } = useCalendar()\n\n  return (\n    \u003c\u003e\n      {months.map(({ year, month, weeks }) =\u003e (\n        \u003cdiv\u003e\n          \u003cheader\u003e\n            \u003ch1\u003e{month} {year}\u003c/h1\u003e\n          \u003c/header\u003e\n          \u003cnav\u003e\n            \u003cbutton {...getPrevMonthProps()}\u003ePrev\u003c/button\u003e\n            \u003cbutton {...getNextMonthProps()}\u003eNext\u003c/button\u003e\n          \u003c/nav\u003e\n          {\n            weeks.map((week) =\u003e\n              week.map((day) =\u003e\n                \u003cbutton {...getDayProps({ day })}\u003e{day.date.getDate()}\u003c/button\u003e\n              ))\n          }\n        \u003c/div\u003e\n      ))}\n    \u003c/\u003e\n  )\n}\n```\n\n## Options\n\n```typescript\nconst calendarProps = useCalendar({\n  availableDates: [new Date('2022-07-11'), new Date('2022-07-12')],\n  events: [{ start: new Date('2022-12-25'), title: 'Christmas' }],\n  firstDayOfWeek: 1,\n  minDate: new Date('2022-07-01'),\n  maxDate: new Date('2022-07-31'),\n  monthsToDisplay: 1,\n  onDateSelected: (day) =\u003e console.log(day.date),\n  selectedDate: new Date('2022-07-11'),\n});\n```\n\n### availableDates\n\n\u003e `Date[]` | optional\n\nWhich days should be selectable on the calendar.\n\n### events\n\n\u003e `{ start: Date, end?: Date, [k: string]: unknown }[]` | optional\n\nList of events. The only required attribute on a `Event` is the `start` date. Any custom attributes you send in, will be returned back on the corresponding days, ex: `isAllDay: true`\n\n### firstDayOfWeek\n\n\u003e `number` | defaults to `0`\n\nFirst day of the week with possible values 0-6 (Sunday to Saturday). Defaults to\nSunday.\n\n### minDate\n\n\u003e `Date` | optional\n\nUsed to calculate the minimum month to render.\n\n### maxDate\n\n\u003e `Date` | optional\n\nUsed to calculate the maximum month to render.\n\n### monthsToDisplay\n\n\u003e `number` | defaults to `1`\n\nNumber of months returned, based off the `selectedDate`. `Infinity` will display all months with available dates.\n\n\n### onDateSelected\n\n\u003e `function(day: Day)` | optional\n\nCalled when the user selects a date.\n\n### selectedDate\n\n\u003e `Date | string | number` | optional\n\nUsed to calculate what month to display on initial render.\n\n\n## Outputs\n\nThe hook will return an object with the following shape:\n\n```typescript\ninterface ICalendarProps {\n  getDayProps: IGetDayPropsFn;\n  getPrevMonthProps: IGetPrevNextPropsFn;\n  getNextMonthProps: IGetPrevNextPropsFn;\n  getPrevYearProps: IGetPrevNextPropsFn;\n  getNextYearProps: IGetPrevNextPropsFn;\n  months: IMonth[];\n  resetState: () =\u003e void;\n}\n```\n\nEach month has the shape:\n\n```typescript\ninterface IMonth {\n  weeks: IDay[][];\n  month: number;\n  year: number;\n}\n```\n\nEach day returned on each week of the months to display is:\n\n```typescript\ninterface IDay {\n  date: Date;\n  events?: IEvent[];\n  isSelectable?: boolean;\n  isSelected?: boolean;\n  isToday?: boolean;\n  isWeekend?: boolean;\n  isAdjacentMonth?: boolean;\n}\n```\n\nAn event is represented by (it can hold any extra data needed):\n\n```typescript\ninterface IEvent {\n  \\[key: string\\]: unknown;\n  end?: Date;\n  start: Date;\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruicsh%2Fuse-calendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruicsh%2Fuse-calendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruicsh%2Fuse-calendar/lists"}